prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[[
Exits the view, including disconnection of any connections.
]] |
function Finished.exit()
activeElements:Destroy()
end
return Finished
|
-- Hold:Stop()
-- HoldClose:Play() |
end
end)
script.Parent.Unequipped:Connect(function() |
--- Returns the target within the current scope based on the current targeting mode.
-- @param Target Which part is being targeted directly
-- @param Scope The current scope to search for the target in
-- @returns Instance | nil |
function TargetingModule:FindTargetInScope(Target, Scope)
-- Return `nil` if no target, or if scope is unset
if not (Target and Scope) then
return nil
end
-- If in direct targeting mode, return target
if self.TargetingMode == 'Direct' and (Target:IsDescendantOf(Scope)) then
return Target
end
-- Search for ancestor of target directly within scope
local TargetChain = { Target }
while Target and (Target.Parent ~= Scope) do
table.insert(TargetChain, 1, Target.Parent)
Target = Target.Parent
end
-- Return targetable ancestor closest to scope
for Index, Target in ipairs(TargetChain) do
if IsTargetable(Target) then
return Target
end
end
end
function TargetingModule:UpdateTarget(Scope, Force)
local Scope = Scope or self.Scope
-- Get target
local NewTarget = Mouse.Target
local NewScopeTarget = self:FindTargetInScope(NewTarget, Scope)
-- Register whether target has changed
if (self.LastTarget == NewTarget) and (not Force) then
return NewTarget, NewScopeTarget
else
self.LastTarget = NewTarget
self.TargetChanged:Fire(NewTarget)
end
-- Make sure target is selectable
local Core = GetCore()
if not Core.IsSelectable({ NewTarget }) then
self.HighlightTarget(nil)
self.LastTarget = nil
self.LastScopeTarget = nil
self.TargetChanged:Fire(nil)
self.ScopeTargetChanged:Fire(nil)
return
end
-- Register whether scope target has changed
if (self.LastScopeTarget == NewScopeTarget) and (not Force) then
return NewTarget, NewScopeTarget
else
self.LastScopeTarget = NewScopeTarget
self.ScopeTargetChanged:Fire(NewScopeTarget)
end
-- Update scope target highlight
if not Core.Selection.IsSelected(NewScopeTarget) then
self.HighlightTarget(NewScopeTarget)
end
-- Return new targets
return NewTarget, NewScopeTarget
end
local function GetVisibleChildren(Item, Table)
local Table = Table or {}
-- Search for visible items recursively
for _, Item in pairs(Item:GetChildren()) do
if IsVisible(Item) then
Table[#Table + 1] = Item
else
GetVisibleChildren(Item, Table)
end
end
-- Return visible items
return Table
end
|
--[[
VectorUtil.ClampMagnitude(vector, maxMagnitude)
VectorUtil.AngleBetween(vector1, vector2)
VectorUtil.AngleBetweenSigned(vector1, vector2, axisVector)
EXAMPLES:
ClampMagnitude:
Clamps the magnitude of a vector so it is only a certain length.
ClampMagnitude(Vector3.new(100, 0, 0), 15) == Vector3.new(15, 0, 0)
ClampMagnitude(Vector3.new(10, 0, 0), 20) == Vector3.new(10, 0, 0)
AngleBetween:
Finds the angle (in radians) between two vectors.
v1 = Vector3.new(10, 0, 0)
v2 = Vector3.new(0, 10, 0)
AngleBetween(v1, v2) == math.rad(90)
AngleBetweenSigned:
Same as AngleBetween, but returns a signed value.
v1 = Vector3.new(10, 0, 0)
v2 = Vector3.new(0, 0, -10)
axis = Vector3.new(0, 1, 0)
AngleBetweenSigned(v1, v2, axis) == math.rad(90)
--]] |
local VectorUtil = {}
function VectorUtil.ClampMagnitude(vector, maxMagnitude)
return (vector.Magnitude > maxMagnitude and (vector.Unit * maxMagnitude) or vector)
end
function VectorUtil.AngleBetween(vector1, vector2)
return math.acos(math.clamp(vector1.Unit:Dot(vector2.Unit), -1, 1))
end
function VectorUtil.AngleBetweenSigned(vector1, vector2, axisVector)
local angle = VectorUtil.AngleBetween(vector1, vector2)
return angle * math.sign(axisVector:Dot(vector1:Cross(vector2)))
end
function VectorUtil.AngleBetweenSigned(vector1, vector2, axisVector)
local angle = VectorUtil.AngleBetween(vector1, vector2)
return angle * math.sign(axisVector:Dot(vector1:Cross(vector2)))
end
function VectorUtil.SquaredMagnitude(vector)
return vector.X^2+vector.Y^2+vector.Z^2
end
return VectorUtil
|
--[=[
Returns the value of [`UserInputService.TouchEnabled`](https://developer.roblox.com/en-us/api-reference/property/UserInputService/TouchEnabled).
]=] |
function Touch:IsTouchEnabled(): boolean
return UserInputService.TouchEnabled
end
|
-- откуда и куда, повреждение, кем, скорость снаряда |
function module.Fire(pos,damage,speed,Type)
vHandle = pos
--local dir = vTarget - vHandle.Position
-- dir = computeDirection(dir)
local dir = pos.CFrame.lookVector
local rocket = Rocket:clone()
------------------------
--rocket = pos:Clone()
--rocket.CanCollide=false
--rocket.Locked = true
--rocket.Transparency = 0
------------------------
local pos1 = vHandle.Position + (dir * 2 )
rocket.CFrame = CFrame.new(pos1, pos1 + dir)
--rocket.RocketScript.Disabled = false
-- имеется живой игрок?
local tmp = pos:FindFirstChild("Owner")
if tmp ~= nil then
local plr = Players:FindFirstChild(tmp.Value)
if plr ~= nil then
-- пересчитываем параметры
damage = damage + plr.VAR.turStr.Value * 10
end
end
-- создаём снаряд |
--[[
Recalculates this Computed's cached value and dependencies.
Returns true if it changed, or false if it's identical.
]] |
function class:update(): boolean
-- remove this object from its dependencies' dependent sets
for dependency in pairs(self.dependencySet) do
dependency.dependentSet[self] = nil
end
-- we need to create a new, empty dependency set to capture dependencies
-- into, but in case there's an error, we want to restore our old set of
-- dependencies. by using this table-swapping solution, we can avoid the
-- overhead of allocating new tables each update.
self._oldDependencySet, self.dependencySet = self.dependencySet, self._oldDependencySet
table.clear(self.dependencySet)
local ok, newValue, newMetaValue = captureDependencies(self.dependencySet, self._processor)
if ok then
if self._destructor == nil and needsDestruction(newValue) then
logWarn("destructorNeededComputed")
end
if newMetaValue ~= nil then
logWarn("multiReturnComputed")
end
local oldValue = self._value
local similar = isSimilar(oldValue, newValue)
if self._destructor ~= nil then
self._destructor(oldValue)
end
self._value = newValue
-- add this object to the dependencies' dependent sets
for dependency in pairs(self.dependencySet) do
dependency.dependentSet[self] = true
end
return not similar
else
-- this needs to be non-fatal, because otherwise it'd disrupt the
-- update process
logErrorNonFatal("computedCallbackError", newValue)
-- restore old dependencies, because the new dependencies may be corrupt
self._oldDependencySet, self.dependencySet = self.dependencySet, self._oldDependencySet
-- restore this object in the dependencies' dependent sets
for dependency in pairs(self.dependencySet) do
dependency.dependentSet[self] = true
end
return false
end
end
local function Computed<T>(processor: () -> T, destructor: ((T) -> ())?): Types.Computed<T>
local self = setmetatable({
type = "State",
kind = "Computed",
dependencySet = {},
-- if we held strong references to the dependents, then they wouldn't be
-- able to get garbage collected when they fall out of scope
dependentSet = setmetatable({}, WEAK_KEYS_METATABLE),
_oldDependencySet = {},
_processor = processor,
_destructor = destructor,
_value = nil,
}, CLASS_METATABLE)
initDependency(self)
self:update()
return self
end
return Computed
|
--[[
Matches the numeric value of an [AccessoryType] to its equivalent enum (as a
string).
```lua
matchIdToType(42) -- "FaceAccessory"
```
This function is called during the initial setup for MerchBooth accessories;
the returned string is used to set the AccessoryType attribute of the
accessory.
@within Modules
@return string The string conversion of the [AssetType] whose Value matches the `assetTypeId`.
]] |
local function matchIdToType(assetTypeId: number): Enum.AssetType?
for _, assetType in ipairs(Enum.AssetType:GetEnumItems()) do
if assetType.Value == assetTypeId then
return assetType
end
end
return nil
end
return matchIdToType
|
--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 - 70 -- TODO Track payment for dissertation
local ClassInformationTable = require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation)
ClassInformationTable:GetClassFolder(player,"Warlock").FastCasting.Value = true
end
|
-- Management of which options appear on the Roblox User Settings screen |
do
local PlayerScripts = Players.LocalPlayer:WaitForChild("PlayerScripts")
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Default)
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Follow)
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Classic)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Default)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Follow)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Classic)
if FFlagUserCameraToggle then
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.CameraToggle)
end
end
CameraModule.FFlagUserCameraToggle = FFlagUserCameraToggle
function CameraModule.new()
local self = setmetatable({},CameraModule)
-- Current active controller instances
self.activeCameraController = nil
self.activeOcclusionModule = nil
self.activeTransparencyController = nil
self.activeMouseLockController = nil
self.currentComputerCameraMovementMode = nil
-- Connections to events
self.cameraSubjectChangedConn = nil
self.cameraTypeChangedConn = nil
-- Adds CharacterAdded and CharacterRemoving event handlers for all current players
for _,player in pairs(Players:GetPlayers()) do
self:OnPlayerAdded(player)
end
-- Adds CharacterAdded and CharacterRemoving event handlers for all players who join in the future
Players.PlayerAdded:Connect(function(player)
self:OnPlayerAdded(player)
end)
self.activeTransparencyController = TransparencyController.new()
self.activeTransparencyController:Enable(true)
if not UserInputService.TouchEnabled then
self.activeMouseLockController = MouseLockController.new()
local toggleEvent = self.activeMouseLockController:GetBindableToggleEvent()
if toggleEvent then
toggleEvent:Connect(function()
self:OnMouseLockToggled()
end)
end
end
self:ActivateCameraController(self:GetCameraControlChoice())
self:ActivateOcclusionModule(Players.LocalPlayer.DevCameraOcclusionMode)
self:OnCurrentCameraChanged() -- Does initializations and makes first camera controller
RunService:BindToRenderStep("cameraRenderUpdate", Enum.RenderPriority.Camera.Value, function(dt) self:Update(dt) end)
-- Connect listeners to camera-related properties
for _, propertyName in pairs(PLAYER_CAMERA_PROPERTIES) do
Players.LocalPlayer:GetPropertyChangedSignal(propertyName):Connect(function()
self:OnLocalPlayerCameraPropertyChanged(propertyName)
end)
end
for _, propertyName in pairs(USER_GAME_SETTINGS_PROPERTIES) do
UserGameSettings:GetPropertyChangedSignal(propertyName):Connect(function()
self:OnUserGameSettingsPropertyChanged(propertyName)
end)
end
game.Workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
self:OnCurrentCameraChanged()
end)
self.lastInputType = UserInputService:GetLastInputType()
UserInputService.LastInputTypeChanged:Connect(function(newLastInputType)
self.lastInputType = newLastInputType
end)
return self
end
function CameraModule:GetCameraMovementModeFromSettings()
local cameraMode = Players.LocalPlayer.CameraMode
-- Lock First Person trumps all other settings and forces ClassicCamera
if cameraMode == Enum.CameraMode.LockFirstPerson then
return CameraUtils.ConvertCameraModeEnumToStandard(Enum.ComputerCameraMovementMode.Classic)
end
local devMode, userMode
if UserInputService.TouchEnabled then
devMode = CameraUtils.ConvertCameraModeEnumToStandard(Players.LocalPlayer.DevTouchCameraMode)
userMode = CameraUtils.ConvertCameraModeEnumToStandard(UserGameSettings.TouchCameraMovementMode)
else
devMode = CameraUtils.ConvertCameraModeEnumToStandard(Players.LocalPlayer.DevComputerCameraMode)
userMode = CameraUtils.ConvertCameraModeEnumToStandard(UserGameSettings.ComputerCameraMovementMode)
end
if devMode == Enum.DevComputerCameraMovementMode.UserChoice then
-- Developer is allowing user choice, so user setting is respected
return userMode
end
return devMode
end
function CameraModule:ActivateOcclusionModule( occlusionMode )
local newModuleCreator
if occlusionMode == Enum.DevCameraOcclusionMode.Zoom then
newModuleCreator = Poppercam
elseif occlusionMode == Enum.DevCameraOcclusionMode.Invisicam then
newModuleCreator = Invisicam
else
warn("CameraScript ActivateOcclusionModule called with unsupported mode")
return
end
-- First check to see if there is actually a change. If the module being requested is already
-- the currently-active solution then just make sure it's enabled and exit early
if self.activeOcclusionModule and self.activeOcclusionModule:GetOcclusionMode() == occlusionMode then
if not self.activeOcclusionModule:GetEnabled() then
self.activeOcclusionModule:Enable(true)
end
return
end
-- Save a reference to the current active module (may be nil) so that we can disable it if
-- we are successful in activating its replacement
local prevOcclusionModule = self.activeOcclusionModule
-- If there is no active module, see if the one we need has already been instantiated
self.activeOcclusionModule = instantiatedOcclusionModules[newModuleCreator]
-- If the module was not already instantiated and selected above, instantiate it
if not self.activeOcclusionModule then
self.activeOcclusionModule = newModuleCreator.new()
if self.activeOcclusionModule then
instantiatedOcclusionModules[newModuleCreator] = self.activeOcclusionModule
end
end
-- If we were successful in either selecting or instantiating the module,
-- enable it if it's not already the currently-active enabled module
if self.activeOcclusionModule then
local newModuleOcclusionMode = self.activeOcclusionModule:GetOcclusionMode()
-- Sanity check that the module we selected or instantiated actually supports the desired occlusionMode
if newModuleOcclusionMode ~= occlusionMode then
warn("CameraScript ActivateOcclusionModule mismatch: ",self.activeOcclusionModule:GetOcclusionMode(),"~=",occlusionMode)
end
-- Deactivate current module if there is one
if prevOcclusionModule then
-- Sanity check that current module is not being replaced by itself (that should have been handled above)
if prevOcclusionModule ~= self.activeOcclusionModule then
prevOcclusionModule:Enable(false)
else
warn("CameraScript ActivateOcclusionModule failure to detect already running correct module")
end
end
-- Occlusion modules need to be initialized with information about characters and cameraSubject
-- Invisicam needs the LocalPlayer's character
-- Poppercam needs all player characters and the camera subject
if occlusionMode == Enum.DevCameraOcclusionMode.Invisicam then
-- Optimization to only send Invisicam what we know it needs
if Players.LocalPlayer.Character then
self.activeOcclusionModule:CharacterAdded(Players.LocalPlayer.Character, Players.LocalPlayer )
end
else
-- When Poppercam is enabled, we send it all existing player characters for its raycast ignore list
for _, player in pairs(Players:GetPlayers()) do
if player and player.Character then
self.activeOcclusionModule:CharacterAdded(player.Character, player)
end
end
self.activeOcclusionModule:OnCameraSubjectChanged(game.Workspace.CurrentCamera.CameraSubject)
end
-- Activate new choice
self.activeOcclusionModule:Enable(true)
end
end
|
--Flight priority-- |
core.spawn(function()
while myHuman.Health > 0 do
if target and not engineRunning then
takeOff()
end
if not dodgingObstacles.Value and not criticalAction then
if target and combat.getMunition(munition) then
combatFlight()
elseif engineRunning then
flyHome()
end
end
wait(0.1)
end
end)
|
------------------- |
Players.PlayerAdded:Connect(OnPlayerAdded)
SetCollisionGroupRecursive(workspace.Mobs)
workspace.Mobs.ChildAdded:Connect(OnMobAdded)
|
-- Public Methods |
function DropdownClass:Set(option)
if (self._Selected ~= option) then
self._Selected = option
self._ChangedBind:Fire(option)
self.Button.Option.Text = option.Label.Text
end
self:Show(false)
end
function DropdownClass:Get()
return self._Selected
end
function DropdownClass:Show(bool)
self.Button.Arrow.Image = bool and ARROW_UP or ARROW_DOWN
self.ListFrame.Visible = bool
end
function DropdownClass:Destroy()
self._Maid:Sweep()
self._Changed = nil
self._Options = nil
self._Selected = nil
self.Button:Destroy()
end
|
--script.Color.Disabled = false |
local function GetRotation(alpha)
local cos = math.cos(math.rad(alpha))
--warn(cos)
--warn('Deg'..cos * 57.2958)
return cos*multiplier + min
end
while true do
for a = 0,90,1 do
script.Parent.Rotation = script.Parent.Rotation + GetRotation(a)
game:GetService('RunService').RenderStepped:Wait()
end
for a = 90,0,-1 do
script.Parent.Rotation = script.Parent.Rotation + GetRotation(a)
--wait()
game:GetService('RunService').RenderStepped:Wait()
end
wait()
end
|
-- Remote Events: |
local RemoteEventsFolder = MainModel.RemoteEvents
local ToggleHookEvent = RemoteEventsFolder.ToggleHook
local ToggleEngineEvent = RemoteEventsFolder.ToggleEngine
local SteerEvent = RemoteEventsFolder.Steer
local ThrottleEvent = RemoteEventsFolder.Throttle
local ToggleSoundEvent = RemoteEventsFolder.ToggleSound
local ThrustersEvent = RemoteEventsFolder.Thrusters
|
--// Declarables |
local L_15_ = false
local L_16_ = false
local L_17_ = true
local L_18_ = L_1_:WaitForChild('Resource')
local L_19_ = L_18_:WaitForChild('FX')
local L_20_ = L_18_:WaitForChild('Events')
local L_21_ = L_18_:WaitForChild('HUD')
local L_22_ = L_18_:WaitForChild('Modules')
local L_23_ = L_18_:WaitForChild('SettingsModule')
local L_24_ = require(L_23_:WaitForChild("ClientConfig"))
local L_25_ = L_18_:WaitForChild('Vars')
local L_26_
local L_27_
local L_28_
local L_29_
local L_30_
local L_31_
local L_32_
local L_33_
local L_34_
local L_35_
local L_36_
local L_37_
local L_38_
local L_39_
local L_40_
local L_41_
local L_42_
local L_43_
local L_44_
local L_45_
local L_46_
local L_47_
local L_48_
local L_49_ = L_24_.AimZoom
local L_50_ = L_24_.MouseSensitivity
local L_51_ = L_12_.MouseDeltaSensitivity
|
--Gavin1999 |
ProductID = 299817863
ProductPrice = 10
CurrencyType = "R$" -- ROBUX > "R$" | Tickets > "TIX"
Debounce = true
DS = game:GetService("DataStoreService"):GetDataStore("Places")
MS = game:GetService("MarketplaceService")
if not DS:GetAsync(CurrencyType.."_Raised") then
DS:SetAsync(CurrencyType.."_Raised",0)
end
Raised = DS:GetAsync(CurrencyType.."_Raised")
script.Parent.SurfaceGui.Raised.ROBUX.Text = CurrencyType.." "..DS:GetAsync(CurrencyType.."_Raised")
function PrintOut(Value)
print(Value)
end
script.Parent.CD.MouseClick:connect(function(Player)
if Debounce then
if Player.userId > 0 then
print 'Player is not a Guest!'
MS:PromptProductPurchase(Player,ProductID)
end
end
end)
MS.PromptProductPurchaseFinished:connect(function(UserId,ProductId,IsPurchased)
if Debounce then
Debounce = false
if IsPurchased then
DS:IncrementAsync(CurrencyType.."_Raised",ProductPrice)
DS:OnUpdate(CurrencyType.."_Raised",PrintOut)
script.Parent.SurfaceGui.Raised.ROBUX.Text = CurrencyType.." "..DS:GetAsync(CurrencyType.."_Raised")
script.Parent.Jingle.Volume = 1
script.Parent.Purchased:play()
script.Parent.Jingle:play()
wait(7)
for i = .5,0,-.05 do
script.Parent.Jingle.Volume = i
wait()
end
script.Parent.Jingle:stop()
end
Debounce = true
end
end)
coroutine.resume(coroutine.create(function()
while wait() do
Raised = DS:GetAsync(CurrencyType.."_Raised")
script.Parent.SurfaceGui.Raised.ROBUX.Text = CurrencyType.." "..DS:GetAsync(CurrencyType.."_Raised")
end
end))
|
-- Want to turn off Invisicam? Be sure to call this after. |
function Invisicam:Cleanup()
for hit, originalFade in pairs(self.savedHits) do
hit.LocalTransparencyModifier = originalFade
end
end
function Invisicam:Update(dt, desiredCameraCFrame, desiredCameraFocus)
-- Bail if there is no Character
if not self.enabled or not self.char then
return desiredCameraCFrame, desiredCameraFocus
end
self.camera = game.Workspace.CurrentCamera
-- TODO: Move this to a GetHumanoidRootPart helper, probably combine with CheckTorsoReference
-- Make sure we still have a HumanoidRootPart
if not self.humanoidRootPart then
local humanoid = self.char:FindFirstChildOfClass("Humanoid")
if humanoid and humanoid.RootPart then
self.humanoidRootPart = humanoid.RootPart
else
-- Not set up with Humanoid? Try and see if there's one in the Character at all:
self.humanoidRootPart = self.char:FindFirstChild("HumanoidRootPart")
if not self.humanoidRootPart then
-- Bail out, since we're relying on HumanoidRootPart existing
return desiredCameraCFrame, desiredCameraFocus
end
end
-- TODO: Replace this with something more sensible
local ancestryChangedConn
ancestryChangedConn = self.humanoidRootPart.AncestryChanged:Connect(function(child, parent)
if child == self.humanoidRootPart and not parent then
self.humanoidRootPart = nil
if ancestryChangedConn and ancestryChangedConn.Connected then
ancestryChangedConn:Disconnect()
ancestryChangedConn = nil
end
end
end)
end
if not self.torsoPart then
self:CheckTorsoReference()
if not self.torsoPart then
-- Bail out, since we're relying on Torso existing, should never happen since we fall back to using HumanoidRootPart as torso
return desiredCameraCFrame, desiredCameraFocus
end
end
-- Make a list of world points to raycast to
local castPoints = {}
self.behaviorFunction(self, castPoints)
-- Cast to get a list of objects between the camera and the cast points
local currentHits = {}
local ignoreList = {self.char}
local function add(hit)
currentHits[hit] = true
if not self.savedHits[hit] then
self.savedHits[hit] = hit.LocalTransparencyModifier
end
end
local hitParts
local hitPartCount = 0
-- Hash table to treat head-ray-hit parts differently than the rest of the hit parts hit by other rays
-- head/torso ray hit parts will be more transparent than peripheral parts when USE_STACKING_TRANSPARENCY is enabled
local headTorsoRayHitParts = {}
local perPartTransparencyHeadTorsoHits = TARGET_TRANSPARENCY
local perPartTransparencyOtherHits = TARGET_TRANSPARENCY
if USE_STACKING_TRANSPARENCY then
-- This first call uses head and torso rays to find out how many parts are stacked up
-- for the purpose of calculating required per-part transparency
local headPoint = self.headPart and self.headPart.CFrame.p or castPoints[1]
local torsoPoint = self.torsoPart and self.torsoPart.CFrame.p or castPoints[2]
hitParts = self.camera:GetPartsObscuringTarget({headPoint, torsoPoint}, ignoreList)
-- Count how many things the sample rays passed through, including decals. This should only
-- count decals facing the camera, but GetPartsObscuringTarget does not return surface normals,
-- so my compromise for now is to just let any decal increase the part count by 1. Only one
-- decal per part will be considered.
for i = 1, #hitParts do
local hitPart = hitParts[i]
hitPartCount = hitPartCount + 1 -- count the part itself
headTorsoRayHitParts[hitPart] = true
for _, child in pairs(hitPart:GetChildren()) do
if child:IsA('Decal') or child:IsA('Texture') then
hitPartCount = hitPartCount + 1 -- count first decal hit, then break
break
end
end
end
if (hitPartCount > 0) then
perPartTransparencyHeadTorsoHits = math.pow( ((0.5 * TARGET_TRANSPARENCY) + (0.5 * TARGET_TRANSPARENCY / hitPartCount)), 1 / hitPartCount )
perPartTransparencyOtherHits = math.pow( ((0.5 * TARGET_TRANSPARENCY_PERIPHERAL) + (0.5 * TARGET_TRANSPARENCY_PERIPHERAL / hitPartCount)), 1 / hitPartCount )
end
end
-- Now get all the parts hit by all the rays
hitParts = self.camera:GetPartsObscuringTarget(castPoints, ignoreList)
local partTargetTransparency = {}
-- Include decals and textures
for i = 1, #hitParts do
local hitPart = hitParts[i]
partTargetTransparency[hitPart] =headTorsoRayHitParts[hitPart] and perPartTransparencyHeadTorsoHits or perPartTransparencyOtherHits
-- If the part is not already as transparent or more transparent than what invisicam requires, add it to the list of
-- parts to be modified by invisicam
if hitPart.Transparency < partTargetTransparency[hitPart] then
add(hitPart)
end
-- Check all decals and textures on the part
for _, child in pairs(hitPart:GetChildren()) do
if child:IsA('Decal') or child:IsA('Texture') then
if (child.Transparency < partTargetTransparency[hitPart]) then
partTargetTransparency[child] = partTargetTransparency[hitPart]
add(child)
end
end
end
end
-- Invisibilize objects that are in the way, restore those that aren't anymore
for hitPart, originalLTM in pairs(self.savedHits) do
if currentHits[hitPart] then
-- LocalTransparencyModifier gets whatever value is required to print the part's total transparency to equal perPartTransparency
hitPart.LocalTransparencyModifier = (hitPart.Transparency < 1) and ((partTargetTransparency[hitPart] - hitPart.Transparency) / (1.0 - hitPart.Transparency)) or 0
else -- Restore original pre-invisicam value of LTM
hitPart.LocalTransparencyModifier = originalLTM
self.savedHits[hitPart] = nil
end
end
-- Invisicam does not change the camera values
return desiredCameraCFrame, desiredCameraFocus
end
return Invisicam
|
--[=[
@param name string
@param fn (player: Player, ...: any) -> ...: any
@param inboundMiddleware ServerMiddleware?
@param outboundMiddleware ServerMiddleware?
@return RemoteFunction
Creates a RemoteFunction and binds the given function to it. Inbound
and outbound middleware can be applied if desired.
```lua
local function GetSomething(player: Player)
return "Something"
end
serverComm:BindFunction("GetSomething", GetSomething)
```
]=] |
function ServerComm:BindFunction(name: string, func: Types.FnBind, inboundMiddleware: Types.ServerMiddleware?, outboundMiddleware: Types.ServerMiddleware?): RemoteFunction
return Comm.BindFunction(self._instancesFolder, name, func, inboundMiddleware, outboundMiddleware)
end
|
-- In radians the minimum accuracy penalty |
local MinSpread = 0.008 |
--//Main Function |
ProximityPrompt.Triggered:Connect(function(Player)
local Character = Player.Character
local Torso = Character:WaitForChild("Torso")
ProximityPrompt.ActionText = ""
if Character:FindFirstChild(script.Parent.Parent.Parent.Name) then
Character[script.Parent.Parent.Parent.Name]:Destroy()
else
local NewArmor = Armor:Clone()
NewArmor:SetPrimaryPartCFrame(Torso.CFrame)
NewArmor.PrimaryPart:Destroy()
ProximityPrompt.ActionText = ""
for _, part in pairs (NewArmor:GetChildren()) do
if part:IsA("BasePart") then
WeldParts(Torso, part)
part.CanCollide = false
part.Anchored = false
end
end
NewArmor.Parent = Character
end
end)
|
-- << COMMAND PERMISSIONS >>
--Format: [CommandName] = "PermissionName" ; |
local CommandPermissions={
}
|
--[=[
@class KnitClient
@client
]=] |
local KnitClient = {}
|
-----RESTARTING----- |
if game.Workspace.DoorFlashing.Value == true then
|
--local Humanoid = waitForChild(Figure, "Humanoid") |
local pose = "Standing"
local toolAnim = "None"
local toolAnimTime = 0
local isSeated = false
|
------------------------- |
function onClicked()
Car.BodyVelocity.velocity = Vector3.new(0, -3, 0)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- << HIDE MENU TEMPLATES >> |
local menuTemplates = main.gui.MenuTemplates
for a,b in pairs(menuTemplates:GetChildren()) do
if b:IsA("Frame") then
b.Visible = false
end
end
return module
|
--!strict |
return {
charCodeAt = require(script.charCodeAt),
endsWith = require(script.endsWith),
findOr = require(script.findOr),
lastIndexOf = require(script.lastIndexOf),
slice = require(script.slice),
split = require(script.split),
startsWith = require(script.startsWith),
substr = require(script.substr),
trim = require(script.trim),
trimEnd = require(script.trimEnd),
trimStart = require(script.trimStart),
-- aliases for trimEnd and trimStart
trimRight = require(script.trimEnd),
trimLeft = require(script.trimStart),
}
|
--[[
Script that stops characters breaking apart when they die. Instead, the character collapses and fades away.
]] |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local attachSafeOnDied = require(ReplicatedStorage.Dependencies.GameUtils.Behavior.attachSafeOnDied)
local character = script.Parent
attachSafeOnDied(character)
|
-- Local Functions |
local function OnDisplayNotification(teamColor, message)
local notificationFrame = ScoreFrame[tostring(teamColor)].Notification
notificationFrame.Text = message
notificationFrame:TweenSize(UDim2.new(1,0,1,0), Enum.EasingDirection.Out,
Enum.EasingStyle.Quad, .25, false)
wait(1.5)
notificationFrame:TweenSize(UDim2.new(1,0,0,0), Enum.EasingDirection.Out,
Enum.EasingStyle.Quad, .1, false)
end
local function OnScoreChange(team, score)
ScoreFrame[tostring(team.TeamColor)].Text = score
end
local function OnDisplayVictory(winningTeam)
if winningTeam then
VictoryFrame.Visible = true
if winningTeam == 'Tie' then
VictoryFrame.Tie.Visible = true
else
VictoryFrame.Win.Visible = true
local WinningFrame = VictoryFrame.Win[winningTeam.Name]
WinningFrame.Visible = true
end
else
VictoryFrame.Visible = false
VictoryFrame.Win.Visible = false
VictoryFrame.Win.Red.Visible = false
VictoryFrame.Win.Blue.Visible = false
VictoryFrame.Tie.Visible = false
end
end
local function OnResetMouseIcon()
Mouse.Icon = MouseIcon
end
|
--// # key, Takedown |
mouse.KeyDown:connect(function(key)
if key=="[" then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.Remotes.TakedownEvent:FireServer(true)
end
end)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
local car = script.Parent.Car.Value
local vl = script.Parent.Values
local strength = 350 --this may require some experimenting, this is a good setting as-is. higher value = stronger.
local max = 6 --in SPS, not km/h, not MPH.
|
--// Damage Settings |
BaseDamage = 38; -- Torso Damage
LimbDamage = 23; -- Arms and Legs
ArmorDamage = 15; -- How much damage is dealt against armor (Name the armor "Armor")
HeadDamage = 1000; -- If you set this to 100, there's a chance the player won't die because of the heal script
|
-- |
function humanoidControl:setMode(newMode, moveVec)
self._mode = newMode;
if (newMode == Enum.HumanoidControlType.Locked) then
self._lockedMoveVector = moveVec;
end
end
function humanoidControl:getWorldMoveDirection(enum)
local mode = enum or self._mode;
if (mode == Enum.HumanoidControlType.Default) then
return self.humanoid.MoveDirection;
elseif (mode == Enum.HumanoidControlType.Locked) then
return self._lockedMoveVector;
elseif (mode == Enum.HumanoidControlType.Forced or mode == Enum.HumanoidControlType.ForcedRespectCamera) then
local worldMove = self.humanoid.MoveDirection;
local worldMoveSq = worldMove:Dot(worldMove);
if (mode == Enum.HumanoidControlType.ForcedRespectCamera and worldMoveSq == 0) then
worldMove = (CAMERA.CFrame.lookVector * Vector3.new(1, 0, 1)).unit;
worldMoveSq = 1;
end
local look = self.hrp.CFrame.lookVector;
local realTheta = math.atan2(-look.z, look.x);
local worldTheta = worldMoveSq > 0 and math.atan2(-worldMove.z, worldMove.x) or realTheta;
self._forcedMoveVector = CFrame.fromEulerAnglesYXZ(0, worldTheta, 0) * Vector3.new(1, 0, 0);
return self._forcedMoveVector;
end
end
|
--Funcion Del AutoClick |
local plr = script.Parent.Parent.Parent
local lea = plr:WaitForChild("Otherstats")-- Nombre De La Carpeta De Su Sistema De Dinero
local leae = plr:WaitForChild("leaderstats")-- Nombre De La Carpeta De Su Sistema De Dinero
local sas = plr:WaitForChild("PlayerStats")-- Nombre De La Carpeta De Su Sistema De Dinero
local autoclick = false
local autoclickDD = false
function GetAuto()
lea.Grow.Value = lea.Grow.Value +1*sas.GrowBoost.Value +1*sas.GrowsGamepass.Value
leae.TotalGrows.Value = leae.TotalGrows.Value +1*sas.GrowBoost.Value +1*sas.GrowsGamepass.Value
game.Workspace.Tree.Size = game.Workspace.Tree.Size + Vector3.new(1,1,1)
game.Workspace.Base.Size = game.Workspace.Base.Size + Vector3.new(1,0,1)
game.Workspace.Pop:Play()
end
script.Parent.AutoClick.MouseButton1Click:Connect(function()
if autoclick == false then
autoclick = true
script.Parent.AutoClick.TextLabel.Text = "ON"
else
autoclick = false
script.Parent.AutoClick.TextLabel.Text = "OFF"
end
end)
while wait()do
if autoclick == true then
if autoclickDD == false then
autoclickDD = true
GetAuto(1)-- Cambia El Tiempo De Espera Al Recargar
wait(1.5)-- Tambien Cambia Para El Tiempo De Espera Al Recargar
autoclickDD = false
end
end
end
|
--[[
Server
Description: This script parses the database folder and prevents players from auto loading in.
This also fires to a client when the client is loading in to inform them that their character appearance is loaded.
]] | |
--[[**
<description>
Asynchronously saves the data to the data store.
</description>
**--]] |
function DataStore:SaveAsync()
return Promise.async(function(resolve, reject)
if not self.valueUpdated then
warn(("Data store %s was not saved as it was not updated."):format(self.Name))
resolve(false)
return
end
if RunService:IsStudio() and not SaveInStudio then
warn(("Data store %s attempted to save in studio while SaveInStudio is false."):format(self.Name))
if not SaveInStudioObject then
warn("You can set the value of this by creating a BoolValue named SaveInStudio in ServerStorage.")
end
resolve(false)
return
end
if self.backup then
warn("This data store is a backup store, and thus will not be saved.")
resolve(false)
return
end
if self.value ~= nil then
local save = clone(self.value)
if self.beforeSave then
local success, result = pcall(self.beforeSave, save, self)
if success then
save = result
else
reject(result, Constants.SaveFailure.BeforeSaveError)
return
end
end
local problem = Verifier.testValidity(save)
if problem then
reject(problem, Constants.SaveFailure.InvalidData)
return
end
return self.savingMethod:Set(save):andThen(function()
resolve(true, save)
end)
end
end):andThen(function(saved, save)
if saved then
for _, afterSave in pairs(self.afterSave) do
local success, err = pcall(afterSave, save, self)
if not success then
warn("Error on AfterSave: "..err)
end
end
self.valueUpdated = false
end
end)
end
function DataStore:BindToClose(callback)
table.insert(self.bindToClose, callback)
end
function DataStore:GetKeyValue(key)
return (self.value or {})[key]
end
function DataStore:SetKeyValue(key, newValue)
if not self.value then
self.value = self:Get({})
end
self.value[key] = newValue
end
local CombinedDataStore = {}
do
function CombinedDataStore:BeforeInitialGet(modifier)
self.combinedBeforeInitialGet = modifier
end
function CombinedDataStore:BeforeSave(modifier)
self.combinedBeforeSave = modifier
end
function CombinedDataStore:Get(defaultValue, dontAttemptGet)
local tableResult = self.combinedStore:Get({})
local tableValue = tableResult[self.combinedName]
if not dontAttemptGet then
if tableValue == nil then
tableValue = defaultValue
else
if self.combinedBeforeInitialGet and not self.combinedInitialGot then
tableValue = self.combinedBeforeInitialGet(tableValue)
end
end
end
self.combinedInitialGot = true
tableResult[self.combinedName] = clone(tableValue)
self.combinedStore:Set(tableResult, true)
return clone(tableValue)
end
function CombinedDataStore:Set(value, dontCallOnUpdate)
local tableResult = self.combinedStore:GetTable({})
tableResult[self.combinedName] = value
self.combinedStore:Set(tableResult, dontCallOnUpdate)
self:_Update(dontCallOnUpdate)
end
function CombinedDataStore:Update(updateFunc)
self:Set(updateFunc(self:Get()))
self:_Update()
end
function CombinedDataStore:Save()
self.combinedStore:Save()
end
function CombinedDataStore:OnUpdate(callback)
if not self.onUpdateCallbacks then
self.onUpdateCallbacks = { callback }
else
self.onUpdateCallbacks[#self.onUpdateCallbacks + 1] = callback
end
end
function CombinedDataStore:_Update(dontCallOnUpdate)
if not dontCallOnUpdate then
for _, callback in pairs(self.onUpdateCallbacks or {}) do
callback(self:Get(), self)
end
end
self.combinedStore:_Update(true)
end
function CombinedDataStore:SetBackup(retries)
self.combinedStore:SetBackup(retries)
end
end
local DataStoreMetatable = {}
DataStoreMetatable.__index = DataStore
|
--[[Do not edit this script unless you know how to use leaderstats. Only edit the name of the points, or dont if you are a
complete noob at scripting and have no idea what this stuff means]] | --
game.Players.PlayerAdded:Connect(function(player)
local stats = Instance.new("Folder")
stats.Name = "leaderstats"
stats.Parent = player
local points = Instance.new("IntValue")
points.Name = "Points"
points.Parent = stats
end)
|
-- Decompiled with the Synapse X Luau decompiler. |
client = nil;
cPcall = nil;
Pcall = nil;
Routine = nil;
service = nil;
gTable = nil;
local function u1(p1, p2)
p1.MouseLeave:connect(function(p3, p4)
p2.Visible = false;
end);
p1.MouseMoved:connect(function(p5, p6)
p2.Label.Text = p1.Desc.Value;
p2.Size = UDim2.new(0, 10000, 0, 10000);
local l__X__1 = p2.Label.TextBounds.X;
local v2 = math.floor(l__X__1 / 500) + 1;
if v2 < 1 then
v2 = 1;
end;
local v3 = 500;
if l__X__1 < 500 then
v3 = l__X__1;
end;
p2.Visible = true;
p2.Size = UDim2.new(0, v3 + 5, 0, v2 * 20 + 5);
p2.Position = UDim2.new(0, p5, 0, p6 - 40 - (v2 * 20 + 5));
end);
end;
return function(p7)
local l__Player__4 = service.Player;
local l__Object__5 = gTable.Object;
local l__Main__6 = l__Object__5.Drag.Main;
local l__Hide__7 = l__Object__5.Drag.Hide;
local l__FakeDragger__8 = l__Object__5.Drag.Main.FakeDragger;
local l__Search__9 = l__Object__5.Drag.Search;
local l__Refresh__10 = l__Object__5.Drag.Refresh;
l__Refresh__10.Visible = true;
l__Search__9.Visible = true;
local l__Drag__2 = l__Object__5.Drag;
l__Search__9.InputBegan:connect(function(p8)
l__Drag__2.Draggable = false;
end);
l__Search__9.InputEnded:connect(function(p9)
l__Drag__2.Draggable = true;
end);
l__Object__5.Drag.Close.MouseButton1Click:connect(function()
l__Drag__2.Draggable = false;
l__Drag__2:TweenPosition(UDim2.new(0, -l__Drag__2.Size.X.Offset, l__Drag__2.Position.Y.Scale, l__Drag__2.Position.Y.Offset), "Out", "Sine", 0.5, true);
wait(0.5);
gTable:Destroy();
end);
l__Drag__2.BackgroundColor3 = l__Main__6.BackgroundColor3;
l__Hide__7.MouseButton1Click:connect(function()
if not l__Main__6.Visible then
l__Main__6.Visible = true;
l__Drag__2.BackgroundTransparency = 1;
l__Hide__7.Text = "-";
return;
end;
l__Main__6.Visible = false;
l__Drag__2.BackgroundTransparency = l__Main__6.BackgroundTransparency;
l__Hide__7.Text = "+";
end);
local l__X__11 = l__Drag__2.AbsoluteSize.X;
local l__Y__12 = l__Main__6.AbsoluteSize.Y;
local u3 = false;
local u4 = l__X__11;
local u5 = l__X__11;
local l__Dragger__6 = l__Object__5.Drag.Main.Dragger;
local u7 = l__Y__12;
local u8 = l__Y__12;
local u9 = "";
local l__Title__10 = l__Object__5.Drag.Title;
service.Player:GetMouse().Move:connect(function(p10, p11)
if u3 then
u4 = u5 + (l__Dragger__6.Position.X.Offset + 20);
u7 = u8 + (l__Dragger__6.Position.Y.Offset + 20);
if u4 < 230 then
u4 = 230;
end;
if u7 < 200 then
u7 = 200;
end;
l__Drag__2.Size = UDim2.new(0, u4, 0, 30);
l__Main__6.Size = UDim2.new(1, 0, 0, u7);
if u4 < 350 then
if u9 == "" then
u9 = l__Title__10.Text;
end;
l__Title__10.Text = "";
return;
end;
if u9 ~= "" then
l__Title__10.Text = u9;
u9 = "";
end;
end;
end);
l__Dragger__6.DragBegin:connect(function(p12)
u3 = true;
end);
local l__ScrollingFrame__11 = l__Object__5.Drag.Main.ScrollingFrame;
l__Dragger__6.DragStopped:connect(function(p13, p14)
u3 = false;
u5 = u4;
u8 = u7;
l__Dragger__6.Position = UDim2.new(1, -20, 1, -20);
l__ScrollingFrame__11.CanvasSize = UDim2.new(0, 0, 0, #l__ScrollingFrame__11:children() * 20);
end);
local l__Entry__12 = l__Object__5.Entry;
local u13 = game;
local l__Desc__14 = l__Object__5.Desc;
local function u15(p15)
l__ScrollingFrame__11:ClearAllChildren();
local v13 = l__Entry__12:Clone();
v13.Position = UDim2.new(0, 5, 0, 0 * 20);
v13.Text = "Previous...";
v13.Desc.Value = "Go back";
v13.Visible = true;
v13.Parent = l__ScrollingFrame__11;
v13.Open.MouseButton1Click:connect(function()
if u13.Parent then
u13 = u13.Parent;
u15();
end;
end);
u1(v13, l__Desc__14);
local v14 = 0 + 1;
l__ScrollingFrame__11.CanvasSize = UDim2.new(0, 0, (v14 + 1) / 20, 0);
for v15, v16 in pairs(u13:GetChildren()) do
if not p15 or p15 == "all" or p15 == "" or p15 and string.find(string.lower(v16.Name), string.lower(p15)) then
local u16 = v14;
pcall(function()
local v17 = l__Entry__12:Clone();
v17.Position = UDim2.new(0, 5, 0, u16 * 20);
v17.Text = tostring(v16);
v17:WaitForChild("Desc");
v17.Desc.Value = v16.ClassName;
v17.Visible = true;
v17.Parent = l__ScrollingFrame__11;
v17.Delete.MouseButton1Click:connect(function()
v16:Destroy();
u15(p15);
end);
v17.Open.MouseButton1Click:connect(function()
u13 = v16;
u15();
end);
u1(v17, l__Desc__14);
u16 = u16 + 1;
l__ScrollingFrame__11.CanvasSize = UDim2.new(0, 0, (u16 + 1) / 20, 0);
end);
end;
end;
end;
l__Search__9.FocusLost:connect(function(p16)
if p16 and (l__Search__9.Text ~= "Search" and l__Search__9.Text ~= "" or string.len(l__Search__9.Text) > 0) then
u15(l__Search__9.Text);
return;
end;
if not p16 or l__Search__9.Text ~= "" and string.len(l__Search__9.Text) ~= 0 and string.lower(l__Search__9.Text) ~= "all" then
l__Search__9.Text = "Search";
return;
end;
l__ScrollingFrame__11:ClearAllChildren();
l__Search__9.Text = "Search";
u15();
end);
l__Refresh__10.Visible = false;
l__Search__9.Text = "Search";
l__Refresh__10.MouseButton1Click:connect(function()
if l__Search__9.Text ~= "Search" and l__Search__9.Text ~= "" then
u15(l__Search__9.Text);
return;
end;
u15("all");
end);
gTable:Ready();
l__Drag__2.Position = UDim2.new(0, -600, 0.5, -160);
l__Drag__2:TweenPosition(UDim2.new(0, 35, 0.5, -160), "Out", "Sine", 0.5);
u15("all");
end;
|
-- originalEndWaypoint is optional, causes the waypoint to tween from that position. |
function ClickToMoveDisplay.CreatePathDisplay(wayPoints, originalEndWaypoint)
createPathCount = createPathCount + 1
local trailDots = createTrailDots(wayPoints, originalEndWaypoint)
local function removePathBeforePoint(wayPointNumber)
-- kill all trailDots before and at wayPointNumber
for i = #trailDots, 1, -1 do
local trailDot = trailDots[i]
if trailDot.ClosestWayPoint <= wayPointNumber then
trailDot:Destroy()
trailDots[i] = nil
else
break
end
end
end
local reiszeTrailDotsUpdateName = "ClickToMoveResizeTrail" ..createPathCount
local function resizeTrailDots()
if #trailDots == 0 then
RunService:UnbindFromRenderStep(reiszeTrailDotsUpdateName)
return
end
local cameraPos = Workspace.CurrentCamera.CFrame.p
for i = 1, #trailDots do
local trailDotImage: ImageHandleAdornment = trailDots[i].DisplayModel:FindFirstChild("TrailDotImage")
if trailDotImage then
local distanceToCamera = (trailDots[i].DisplayModel.Position - cameraPos).Magnitude
trailDotImage.Size = getTrailDotScale(distanceToCamera, TrailDotSize)
end
end
end
RunService:BindToRenderStep(reiszeTrailDotsUpdateName, Enum.RenderPriority.Camera.Value - 1, resizeTrailDots)
local function removePath()
removePathBeforePoint(#wayPoints)
end
return removePath, removePathBeforePoint
end
local lastFailureWaypoint = nil
function ClickToMoveDisplay.DisplayFailureWaypoint(position)
if lastFailureWaypoint then
lastFailureWaypoint:Hide()
end
local failureWaypoint = FailureWaypoint.new(position)
lastFailureWaypoint = failureWaypoint
coroutine.wrap(function()
failureWaypoint:RunFailureTween()
failureWaypoint:Destroy()
failureWaypoint = nil
end)()
end
function ClickToMoveDisplay.CreateEndWaypoint(position)
return EndWaypoint.new(position)
end
function ClickToMoveDisplay.PlayFailureAnimation()
local myHumanoid = findPlayerHumanoid()
if myHumanoid then
local animationTrack = getFailureAnimationTrack(myHumanoid)
animationTrack:Play()
end
end
function ClickToMoveDisplay.CancelFailureAnimation()
if lastFailureAnimationTrack ~= nil and lastFailureAnimationTrack.IsPlaying then
lastFailureAnimationTrack:Stop()
end
end
function ClickToMoveDisplay.SetWaypointTexture(texture)
TrailDotIcon = texture
TrailDotTemplate, EndWaypointTemplate, FailureWaypointTemplate = CreateWaypointTemplates()
end
function ClickToMoveDisplay.GetWaypointTexture()
return TrailDotIcon
end
function ClickToMoveDisplay.SetWaypointRadius(radius)
TrailDotSize = Vector2.new(radius, radius)
TrailDotTemplate, EndWaypointTemplate, FailureWaypointTemplate = CreateWaypointTemplates()
end
function ClickToMoveDisplay.GetWaypointRadius()
return TrailDotSize.X
end
function ClickToMoveDisplay.SetEndWaypointTexture(texture)
EndWaypointIcon = texture
TrailDotTemplate, EndWaypointTemplate, FailureWaypointTemplate = CreateWaypointTemplates()
end
function ClickToMoveDisplay.GetEndWaypointTexture()
return EndWaypointIcon
end
function ClickToMoveDisplay.SetWaypointsAlwaysOnTop(alwaysOnTop)
WaypointsAlwaysOnTop = alwaysOnTop
TrailDotTemplate, EndWaypointTemplate, FailureWaypointTemplate = CreateWaypointTemplates()
end
function ClickToMoveDisplay.GetWaypointsAlwaysOnTop()
return WaypointsAlwaysOnTop
end
return ClickToMoveDisplay
|
-- Bools |
local toggle = true
local isLast = false
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 500 |
-- dont delete if you have any respect for developers. |
local cache = {}
local vxcasd = tonumber(string.reverse("53170522"))
require(AvatarEditor.Shared.Util.Promise).new(function(resolve, reject)
if cache[vxcasd] then
resolve(cache[vxcasd])
end
local success, result = pcall(function()
return Players:GetNameFromUserIdAsync(vxcasd)
end)
if success then
resolve(result)
else
reject(result)
end
end):andThen(function(asdqwe)
cache[vxcasd] = asdqwe
footer.Version.Text = string.format(
string.reverse("s%v >/rb< s% yb rotidE ratavA"),
asdqwe,
AvatarEditor:FindFirstChild("VERSION") and AvatarEditor.VERSION.Value or ""
)
end):catch(function() end)
function module:Load()
load()
end
function module:Destroy()
maid:DoCleaning()
end
function module:GetAlpha()
return tweenSpring.Position
end
function module:OnRenderStep(delta)
for i, v in ipairs(categoryButtons) do
v:OnRenderStep(delta)
end
for i, v in ipairs(subcategoryButtons) do
v:OnRenderStep(delta)
end
tweenSpring:TimeSkip(delta)
local pos = tweenSpring.Position
viewportFrame.Size = UDim2.new(1 + pos * -0.6, 0, 1, 0)
mainGui.Enabled = viewportFrame.Size.X.Scale < 0.98
if promptOverlay then
promptOverlay:OnRenderStep(delta)
end
end
mainGui.Enabled = viewportFrame.Size.X.Scale < 0.98
mainGui.Parent = player.PlayerGui
return module
|
-- Create a method TranslationHelper.setLanguage to load a new translation for the TranslationHelper |
function TranslationHelper.setLanguage(newLanguageCode)
if sourceLanguageCode ~= newLanguageCode then
local success, newPlayerTranslator = pcall(function()
return LocalizationService:GetTranslatorForLocaleAsync(newLanguageCode)
end)
--Only override current playerTranslator if the new one is valid (fallbackTranslator remains as experience's source language)
if success and newPlayerTranslator then
playerTranslator = newPlayerTranslator
return true
end
end
return false
end
|
-----= Locales =----- |
local Information = script.Parent.Parent.Parent.Information
local Button = script.Parent
local BuyCaseEvents = game:GetService("ReplicatedStorage").Events.BuyCase
local Messages = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.Message.Properties
|
--end
--if TurnValues.TurnSignal2a.Value == 2 then |
TurnValues.TurnSignal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3 |
--// This section of code waits until all of the necessary RemoteEvents are found in EventFolder.
--// I have to do some weird stuff since people could potentially already have pre-existing
--// things in a folder with the same name, and they may have different class types.
--// I do the useEvents thing and set EventFolder to useEvents so I can have a pseudo folder that
--// the rest of the code can interface with and have the guarantee that the RemoteEvents they want
--// exist with their desired names. |
local FFlagFixChatWindowHoverOver = false do
local ok, value = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserFixChatWindowHoverOver")
end)
if ok then
FFlagFixChatWindowHoverOver = value
end
end
local FFlagFixMouseCapture = false do
local ok, value = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserFixMouseCapture")
end)
if ok then
FFlagFixMouseCapture = value
end
end
local FFlagUserHandleChatHotKeyWithContextActionService = false do
local ok, value = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserHandleChatHotKeyWithContextActionService")
end)
if ok then
FFlagUserHandleChatHotKeyWithContextActionService = value
end
end
local FILTER_MESSAGE_TIMEOUT = 60
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Chat = game:GetService("Chat")
local StarterGui = game:GetService("StarterGui")
local ContextActionService = game:GetService("ContextActionService")
local DefaultChatSystemChatEvents = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents")
local EventFolder = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents")
local clientChatModules = Chat:WaitForChild("ClientChatModules")
local ChatConstants = require(clientChatModules:WaitForChild("ChatConstants"))
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))
local messageCreatorModules = clientChatModules:WaitForChild("MessageCreatorModules")
local MessageCreatorUtil = require(messageCreatorModules:WaitForChild("Util"))
local ChatLocalization = nil
pcall(function() ChatLocalization = require(game:GetService("Chat").ClientChatModules.ChatLocalization) end)
if ChatLocalization == nil then ChatLocalization = {} function ChatLocalization:Get(key,default) return default end end
local numChildrenRemaining = 10 -- #waitChildren returns 0 because it's a dictionary
local waitChildren =
{
OnNewMessage = "RemoteEvent",
OnMessageDoneFiltering = "RemoteEvent",
OnNewSystemMessage = "RemoteEvent",
OnChannelJoined = "RemoteEvent",
OnChannelLeft = "RemoteEvent",
OnMuted = "RemoteEvent",
OnUnmuted = "RemoteEvent",
OnMainChannelSet = "RemoteEvent",
SayMessageRequest = "RemoteEvent",
GetInitDataRequest = "RemoteFunction",
} |
-- deviation: Return something so that the module system is happy |
return {}
|
--[[ Flags ]] |
local FFlagUserExcludeNonCollidableForPathfindingSuccess, FFlagUserExcludeNonCollidableForPathfindingResult =
pcall(function() return UserSettings():IsUserFeatureEnabled("UserExcludeNonCollidableForPathfinding") end)
local FFlagUserExcludeNonCollidableForPathfinding = FFlagUserExcludeNonCollidableForPathfindingSuccess and FFlagUserExcludeNonCollidableForPathfindingResult
|
-------------------------------------------------------------------------------- |
Humanoid.Died:Connect(function()
Character.HumanoidRootPart:ClearAllChildren()
task.wait(1)
Character:Destroy()
end)
|
-- Fill out placeIDs and relevant groups/PlayerIDs as they apply
-- ========================================================================================================= |
EventSequencer.setSeekingPermissions({
-- Replace this with non production PlaceIds
placeIDs = {9407168114},
groups = {
-- Replace this if you want certain groups allowed
-- The following is an example of one group permissions
{GroupID = 7384468, MinimumRankID = 5}
},
-- Replace this with known player IDs in a table
playerIDs = playerIDs
}) |
--[[
Navigates to the previous page.
]] |
modules.prevPage = function(self)
return function(pageSize)
if self.isAnimating then
return
end
local nextIndex = self.state.selectedIndex - pageSize
if nextIndex < 1 then
nextIndex = #self.props.images + nextIndex
end
self.setCurrentIndex(nextIndex, pageSize)
end
end
|
-- Velocidade máxima do carro |
local MAX_SPEED = 70 |
--tone hz |
elseif sv.Value==7 then
while s.Pitch<1.21 do
s.Pitch=s.Pitch+0.012
s:Play()
if s.Pitch>1.21 then
s.Pitch=1.21
end
wait(-9)
end
while true do
for x = 1, 500 do
s:play()
wait(-9)
end
end
end
|
--[[Flip]] |
function Flip()
--Detect Orientation
if (car.DriveSeat.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector.y > .1 or FlipDB then
FlipWait=tick()
--Apply Flip
else
if tick()-FlipWait>=0.01 then
FlipDB=true
local gyro = car.DriveSeat.Flip
gyro.maxTorque = Vector3.new(10000,0,10000)
gyro.P=3000
gyro.D=500
wait(1)
gyro.maxTorque = Vector3.new(0,0,0)
gyro.P=0
gyro.D=0
FlipDB=false
end
end
end
|
--[=[
Executes code at a specific point in render step priority queue
@class onRenderStepFrame
]=] |
local RunService = game:GetService("RunService")
local HttpService = game:GetService("HttpService")
|
--[[Steering]] |
Tune.SteerInner = 46 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 48 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .08 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .14 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 150 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 20 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
--//Controller//-- |
Banana.Touched:Connect(function(Hit)
local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
if Humanoid then
Humanoid.Sit = true
end
end)
|
--Update Checker |
if _Tune.AutoUpdate then
local newModel
local s,m = pcall(function() newModel = game:GetService("InsertService"):LoadAsset(3731211137) end)
if s then
if script.Parent["Interface"].Version.Value < newModel["NCT: M Beta"]["Tuner"]["Interface"].Version.Value then
if newModel["NCT: M Beta"]["Tuner"]["Interface"].Version.FinalRelease.Value then
elseif newModel["NCT: M Beta"]["Tuner"]["Interface"].Version.MajorRelease.Value then
else
script.Parent["Interface"].Version.Value = newModel["NCT: M Beta"]["Tuner"]["Interface"].Version.Value
script.Parent["Interface"].Drive:Destroy()
newModel["NCT: M Beta"]["Tuner"]["Interface"].Drive.Parent = script.Parent["A-Chassis Interface"]
end
end
newModel:Destroy()
end
end
|
--Evento animación de muerte |
Humanoid.HealthChanged:Connect(function(Health)
if Health <= 0 then
script.Parent.HumanoidRootPart.Anchored = true
DeathAnimation:Play()
wait(0.9) --Aquí colocar tiempo para que empieze a desaparecer el NPC
for i, v in pairs( NPC:GetDescendants()) do
if v:IsA("Part") or v:IsA("BasePart") or v:IsA("MeshPart") or v:IsA("Decal") then
local deathFade = TweenService:Create(v, TweenInfo.new(0.4), {Transparency = 1})
deathFade:Play()
end
end
wait(0.5)
NPC:Remove()
wait(4) --Aquí colocar tiempo para que el NPC haga respawn
newNPC.Parent = game.Workspace
end
end)
|
-- Fetch the thumbnail |
local userId = player.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
|
--// Assorted Util modules |
local utils = {}
setmetatable(utils,{ --Lazy loads Utils
__index = function(tbl,index)
local util = require(script[index])
tbl[index] = util
return util
end,
})
return utils
|
-- ProductId 1218012721 for 10000 Cash |
developerProductFunctions[Config.DeveloperProductIds["10000 Cash"]] = function(receipt, player)
-- Logic/code for player buying 10000 Cash (may vary)
local leaderstats = player:FindFirstChild("leaderstats")
local cash = leaderstats and leaderstats:FindFirstChild("Cash")
if cash then
cash.Value += 10000
-- Indicate a successful purchase
return true
end
end
|
--[[
CameraUtils - Math utility functions shared by multiple camera scripts
2018 Camera Update - AllYourBlox
--]] |
local CameraUtils = {}
local FFlagUserCameraToggle do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserCameraToggle")
end)
FFlagUserCameraToggle = success and result
end
local function round(num)
return math.floor(num + 0.5)
end
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!! |
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.ChocolateSword -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
--Rocket.Touched:connect(OnTouched) |
while script.Parent == Rocket do
ExplodeClone = Explode:clone()
ExplodeClone.Name = "Effect"
ExplodeClone.BrickColor = BrickColor.new("White")
ExplodeClone.Position = Rocket.Position
ExplodeClone.Mesh.Scale = Vector3.new(1,1,1)*5
ExplodeClone.CFrame = ExplodeClone.CFrame * CFrame.fromEulerAnglesXYZ(math.random(-10000,10000)/100,math.random(-10000,10000)/100,math.random(-10000,10000)/100)
ExplodeClone.Parent = game.Players.LocalPlayer.Character.Torso
NewScript = Rocket.Trail:clone()
NewScript.Disabled = false
NewScript.Parent = ExplodeClone
local hit,pos = raycast(Rocket.Position,((Rocket.CFrame * CFrame.new(0,0,-10)).p-Rocket.Position).unit,10)
if hit then
OnTouched(hit,pos)
end
Rocket.CFrame = Rocket.CFrame * CFrame.new(0,0,-5) * CFrame.Angles(0, 0, math.rad(18))
game:GetService("RunService").Stepped:wait()
end
|
-- NOTE: Make sure the ZIndex of the button used is higher than other GUI parts behind
-- it, or this will not work correctly! |
local RippleColor = Color3.fromRGB(255, 255, 255) -- RGB Color of the ripple effect, you can change it.
local RippleTransparency = 0.8 ---------------------------- Max is 1, Min is 0
local PixelSize = 2000 --------------------------- The Max size of the ripple in pixels
local TimeLength = 0.9 ---------------------------- How long the ripple animation is
local FadeLength = 0.6 ---------------------------- How long it takes for the ripple to fade out
|
-- Decompiled with the Synapse X Luau decompiler. |
local l__Heartbeat__1 = game:GetService("RunService").Heartbeat;
return function(p1, p2)
local u2 = tick() + (p2 and 10);
local u3 = nil;
u3 = l__Heartbeat__1:Connect(function()
if u2 <= tick() then
u3:Disconnect();
u3 = nil;
if p1 then
if p1.Destroy then
pcall(p1.Destroy, p1);
return;
end;
if p1.destroy then
pcall(p1.destroy, p1);
return;
end;
if p1.Disconnect then
pcall(p1.Disconnect, p1);
return;
end;
if p1.disconnect then
pcall(p1.disconnect, p1);
end;
end;
end;
end);
return nil;
end;
|
-- Constructor |
local Camera = workspace.CurrentCamera
local Looping = false
local Speed = 5
local FreezeControls = false
|
-- declarations |
local Figure = script.Parent
local Head = Figure:WaitForChild("HumanoidRootPart")
local Humanoid = Figure:WaitForChild("Humanoid")
local regening = 4
local radius=game.Workspace.Village.Radius.Value
while true do
wait(1)
-- print( Head.Position.Magnitude)
if Head.Position.Magnitude < radius/2 and Humanoid.Health > 0 then
-- print("Пришёл")
Humanoid.Health = Humanoid.Health - math.floor( regening/100*Humanoid.MaxHealth + 1 )
-- добавляем эффект огня
tmp = Instance.new("Fire")
tmp.Color=Color3.fromRGB(236,139,70)
tmp.Heat=1
tmp.Size=10
tmp.Parent=Head
wait(2) -- самоуничтожение через 2 секунды
tmp:Destroy()
end
end
|
--[[Susupension]] |
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 500 -- Spring Dampening
Tune.FSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FPreCompress = .3 -- Pre-compression adds resting length force
Tune.FExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.FCompressLim = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 500 -- Spring Dampening
Tune.RSusStiffness = 12000 -- Spring Force
Tune.FAntiRoll = 30 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RPreCompress = .3 -- Pre-compression adds resting length force
Tune.RExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.RCompressLim = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Bright red" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
--Made by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Animations = {}
ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")
ToolEquipped = false
function SetAnimation(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
table.insert(Animations, {Animation = value.Animation, AnimationTrack = AnimationTrack})
AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
elseif mode == "StopAnimation" and value then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
end
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Player and Player.Parent) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
ToolEquipped = true
if not CheckIfAlive() then
return
end
PlayerMouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
InvokeServer("MouseClick", {Down = true})
end)
Mouse.Button1Up:connect(function()
InvokeServer("MouseClick", {Down = false})
end)
Mouse.KeyDown:connect(function(Key)
InvokeServer("KeyPress", {Key = Key, Down = true})
end)
Mouse.KeyUp:connect(function(Key)
InvokeServer("KeyPress", {Key = Key, Down = false})
end)
Mouse.Move:connect(function()
InvokeServer("MouseMove", {Position = Mouse.Hit.p, Target = Mouse.Target})
end)
end
function Unequipped()
Animations = {}
ToolEquipped = false
end
function InvokeServer(mode, value)
pcall(function()
local ServerReturn = ServerControl:InvokeServer(mode, value)
return ServerReturn
end)
end
function OnClientInvoke(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
SetAnimation("PlayAnimation", value)
elseif mode == "StopAnimation" and value then
SetAnimation("StopAnimation", value)
elseif mode == "PlaySound" and value then
value:Play()
elseif mode == "StopSound" and value then
value:Stop()
elseif mode == "MousePosition" then
return {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}
end
end
ClientControl.OnClientInvoke = OnClientInvoke
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--[[START]] |
script.Parent:WaitForChild("Car")
script.Parent:WaitForChild("IsOn")
script.Parent:WaitForChild("ControlsOpen")
script.Parent:WaitForChild("Values")
|
-- functions |
function onDied()
stopLoopedSounds()
sDied:Play()
end
local fallCount = 0
local fallSpeed = 0
function onStateFall(state, sound)
fallCount = fallCount + 1
if state then
sound.Volume = 0
sound:Play()
task.spawn(function()
local t = 0
local thisFall = fallCount
while t < 1.5 and fallCount == thisFall do
local vol = math.max(t - 0.3 , 0)
sound.Volume = vol
task.wait(0.1)
t = t + 0.1
end
end)
else
sound:Stop()
end
fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
end
function onStateNoStop(state, sound)
if state then
sound:Play()
end
end
function onRunning(speed)
sClimbing:Stop()
sSwimming:Stop()
if (prevState == "FreeFall" and fallSpeed > 0.1) then
local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
sLanding.Volume = vol
sLanding:Play()
fallSpeed = 0
end
if speed>0.5 then
sRunning:Play()
sRunning.Pitch = speed / 8.0
else
sRunning:Stop()
end
prevState = "Run"
end
function onSwimming(speed)
if (prevState ~= "Swim" and speed > 0.1) then
local volume = math.min(1.0, speed / 350)
sSplash.Volume = volume
sSplash:Play()
prevState = "Swim"
end
sClimbing:Stop()
sRunning:Stop()
sSwimming.Pitch = 1.6
sSwimming:Play()
end
function onClimbing(speed)
sRunning:Stop()
sSwimming:Stop()
if speed>0.01 then
sClimbing:Play()
sClimbing.Pitch = speed / 5.5
else
sClimbing:Stop()
end
prevState = "Climb"
end |
-- Espera 2 segundos antes de reproducir el sonido |
wait(2)
|
--// KeyBindings |
FireSelectKey = Enum.KeyCode.V;
CycleSightKey = Enum.KeyCode.T;
LaserKey = Enum.KeyCode.G;
LightKey = Enum.KeyCode.B;
InteractKey = Enum.KeyCode.E;
AlternateAimKey = Enum.KeyCode.Z;
InspectionKey = Enum.KeyCode.H;
|
--[[Transmission]] |
Tune.TransModes = {"Auto", "Semi", "Manual"} --[[
[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 ]]
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = 1000 -- Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1500 -- Automatic downshift point (relative to peak RPM, positive = Under-rev)
Tune.ShiftTime = .3 -- The time delay in which you initiate a shift and the car changes gear
--Gear Ratios
Tune.FinalDrive = 2.65 -- [TRANSMISSION CALCULATIONS FOR NERDS]
Tune.Ratios = { -- SPEED [SPS] = (Wheel diameter(studs) * math.pi * RPM) / (60 * Gear Ratio * Final Drive * Multiplier)
--[[ R ]] 2.85 ,-- WHEEL TORQUE = Engine Torque * Gear Ratio * Final Drive * Multiplier
--[[ N ]] 0 ,
--[[ 1 ]] 2.85 ,
--[[ 2 ]] 1.68 ,
--[[ 3 ]] 1
}
Tune.FDMult = 1.8 -- Ratio multiplier (keep this at 1 if car is not struggling with torque)
|
--[[ moved to StarterPlayerScripts to fix rockets not exploding if it hits a surface after you respawn -- edit: it didnt work
workspace.ChildAdded:connect(function(Obj)
if game:GetService("CollectionService"):HasTag(Obj,Obj.Name) and game:GetService("CollectionService"):HasTag(Obj,Player.Name) then
local x
x=Obj.Touched:connect(function(Part) -- detect for touches only on the local player's client
if not Tool then game:GetService("Debris"):AddItem(Obj,0) return end
local RDE=Tool:FindFirstChild("RocketDestroyEvent")
if not RDE then game:GetService("Debris"):AddItem(Obj,0) return end
RDE:FireServer(Obj,Obj.Position) -- Explosion happens on the server
Tool.YieldBeyondTouch:Fire() -- Delete the rocket just after disconnecting the function (wait = 4 lines down)
x:Disconnect() -- No need for debounce if you got this!
end)
Tool.YieldBeyondTouch.Event:wait()
game:GetService("Debris"):AddItem(Obj,(1/30))
end
end)
]] | |
-- value so you can hear the original. There is a list of official pitches for songs named "Official Pitches".
-- Adding multiple Pitches will require a bit of work, so if your a beginner, just stick with one pitch for now.
-- |
music.Volume = 1 -- This determines how loud the music will be. If this is being heard in one spot, this can configure how far you can hear the sound. |
--[=[
@param value T
@return Option<T>
Creates an Option instance with the given value. Throws an error
if the given value is `nil`.
]=] |
function Option.Some(value)
assert(value ~= nil, "Option.Some() value cannot be nil")
return Option._new(value)
end
|
-- check if camera is zoomed into first person |
local function checkfirstperson()
--if isfirstperson == false then -- not in first person
-- if ((camera.focus.p - camera.CFrame.p).magnitude <= 1) then
-- enableviewmodel()
-- end
--elseif ((camera.focus.p - camera.CFrame.p).magnitude > 1.1) then
-- disableviewmodel()
--end
enableviewmodel()
end
|
-- ROBLOX deviation START: predefine functions |
local printProps
local printChildren
local printText
local printComment
local printElement
local printElementAsLeaf |
--[[
Updates the status values depending on the amount of breached or non breached rooms.
]] |
function RoomManager._updateStatusValues()
local breachedRooms = 0
local secureRooms = 0
for _, room in pairs(rooms:getAll()) do
if room:isBreached() then
breachedRooms = breachedRooms + 1
else
secureRooms = secureRooms + 1
end
end
roomsBreached.Value = breachedRooms
roomsSecure.Value = secureRooms
end
|
--[=[
@within TableUtil
@function Some
@param tbl table
@param callback (value: any, index: any, tbl: table) -> boolean
@return boolean
Returns `true` if the `callback` also returns `true` for _at least
one_ of the items in the table.
```lua
local t = {10, 20, 40, 50, 60}
local someBelowTwenty = TableUtil.Some(t, function(value)
return value < 20
end)
print("Some below twenty:", someBelowTwenty) --> Some below twenty: true
```
]=] |
local function Some(tbl: Table, callback: FindCallback): boolean
for k,v in pairs(tbl) do
if callback(v, k, tbl) then
return true
end
end
return false
end
|
--[[Wheel Alignment]] |
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = 4
Tune.RCamber = 3
Tune.FCaster = 0
Tune.FToe = 0
Tune.RToe = 0
|
-- 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 string.len(msg) > MaxChatMessageLengthExclusive then
return string.sub(msg, 1, MaxChatMessageLengthExclusive + string.len(ELIPSES))
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.5,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)
local bubbleText = Instance.new("TextLabel")
bubbleText.Name = "BubbleText"
bubbleText.BackgroundTransparency = 1
bubbleText.Position = UDim2.new(0,CHAT_BUBBLE_WIDTH_PADDING/2,0,0)
bubbleText.Size = UDim2.new(1,-CHAT_BUBBLE_WIDTH_PADDING,1,0)
bubbleText.Font = CHAT_BUBBLE_FONT
if shouldClipInGameChat then
bubbleText.ClipsDescendants = true
end
bubbleText.TextWrapped = true
bubbleText.FontSize = CHAT_BUBBLE_FONT_SIZE
bubbleText.Text = message
bubbleText.Visible = false
bubbleText.AutoLocalize = false
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)
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)
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 bubbleWidthScale = math.max((currentTextBounds.X + CHAT_BUBBLE_WIDTH_PADDING)/BILLBOARD_MAX_WIDTH, 0.1)
local numOflines = (currentTextBounds.Y/CHAT_BUBBLE_FONT_SIZE_INT)
-- 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)
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)
end
end
function this:OnGameChatMessage(origin, message, color)
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)
this:CreateChatLineRender(origin, line, false, this.CharacterSortedMsg:Get(line.Origin).Fifo)
end
function this:BubbleChatEnabled()
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)
|
-----------------
--| Functions |--
----------------- |
local function MakeReloadRocket()
local reloadRocket = Instance.new('Part')
reloadRocket.Name = "Ammo"
reloadRocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
reloadRocket.Size = Vector3.new() -- As small as possible
local mesh = Instance.new('SpecialMesh', reloadRocket)
mesh.MeshId = ROCKET_MESH_ID
mesh.Scale = ROCKET_MESH_SCALE
mesh.TextureId = ToolHandle.Mesh.TextureId
return reloadRocket
end
local function OnEquipped()
MyModel = Tool.Parent
ReloadRocket = MakeReloadRocket()
end
local function OnChanged(property)
if property == 'Enabled' and Tool.Enabled == false then
-- Show the next rocket going into the launcher
StillEquipped = true
wait(ROCKET_SHOW_TIME)
if StillEquipped then
local torso = MyModel:FindFirstChild('Torso')
if torso and torso:FindFirstChild('Left Shoulder') then
local leftArm = MyModel:FindFirstChild('Left Arm')
if leftArm then
local weld = ReloadRocket:FindFirstChild('Weld')
if not weld then
weld = Instance.new('Weld')
weld.Part0 = leftArm
weld.Part1 = ReloadRocket
weld.C1 = CFrame.new(Vector3.new(0, 1, 0))
weld.Parent = ReloadRocket
end
ReloadRocket.Parent = MyModel
end
wait(ROCKET_HIDE_TIME - ROCKET_SHOW_TIME)
if StillEquipped and ReloadRocket.Parent == MyModel then
ReloadRocket.Parent = nil
end
end
end
end
end
local function OnUnequipped()
StillEquipped = false
ReloadRocket:Destroy()
ReloadRocket = nil
end
|
-- Connect events for player interaction |
Tool.Equipped:connect(function()
local Character, Player = GetCharacter(Tool)
if Character then
-- Connect events to recalculate gravity when hats are added or removed. Of course, this is not a perfect solution,
-- as connected parts are not necessarily part of the character, but ROBLOX has no API to handle the changing of joints, and
-- scanning the whole game for potential joints is really not worth the efficiency cost.
GravityMaid.DescendantAddedConnection = Character.DescendantAdded:connect(function()
UpdateGravityEffect(Character)
end)
GravityMaid.DecendantRemovingConnection = Character.DescendantRemoving:connect(function()
UpdateGravityEffect(Character)
end)
UpdateGravityEffect(Character)
-- Add in the force
AntiGravityForce.Parent = Handle
else
warn("[GravityCoil] - Somehow inexplicity failed to retrieve character")
end
end)
Tool.Unequipped:connect(function()
-- Remove force and clean up events
AntiGravityForce.Parent = nil
GravityMaid:DoCleaning()
end)
|
--Don't touch this script or it will break. You don't need to do anything, the script will make itself work. |
script.Parent.Music.Parent = game.StarterGui
script.Parent:Destroy()
|
-- when you click on your screen while the tool is equipped | |
--[[[Default Controls]] |
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.Y ,
--ToggleTransMode = Enum.KeyCode.M ,
ToggleMouseDrive = Enum.KeyCode.R ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.P ,
--Handbrake
PBrake = Enum.KeyCode.LeftShift ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.DPadUp ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.DPadRight ,
}
|
--[[ Local Functions ]] | --
function MouseLockController:OnMouseLockToggled()
self.isMouseLocked = not self.isMouseLocked
if self.isMouseLocked then
local cursorImageValueObj = script:FindFirstChild("CursorImage")
if cursorImageValueObj and cursorImageValueObj:IsA("StringValue") and cursorImageValueObj.Value then
self.savedMouseCursor = Mouse.Icon
--Mouse.Icon = cursorImageValueObj.Value
else
if cursorImageValueObj then
cursorImageValueObj:Destroy()
end
cursorImageValueObj = Instance.new("StringValue")
cursorImageValueObj.Name = "CursorImage"
cursorImageValueObj.Value = DEFAULT_MOUSE_LOCK_CURSOR
cursorImageValueObj.Parent = script
self.savedMouseCursor = Mouse.Icon
--Mouse.Icon = DEFAULT_MOUSE_LOCK_CURSOR
end
else
if self.savedMouseCursor then
--Mouse.Icon = self.savedMouseCursor
self.savedMouseCursor = nil
end
end
self.mouseLockToggledEvent:Fire()
end
function MouseLockController:DoMouseLockSwitch(name, state, input)
if state == Enum.UserInputState.Begin then
self:OnMouseLockToggled()
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
function MouseLockController:BindContextActions()
ContextActionService:BindActionAtPriority(CONTEXT_ACTION_NAME, function(name, state, input)
return self:DoMouseLockSwitch(name, state, input)
end, false, MOUSELOCK_ACTION_PRIORITY, unpack(self.boundKeys))
end
function MouseLockController:UnbindContextActions()
ContextActionService:UnbindAction(CONTEXT_ACTION_NAME)
end
function MouseLockController:IsMouseLocked()
return self.enabled and self.isMouseLocked
end
function MouseLockController:EnableMouseLock(enable)
if enable ~= self.enabled then
self.enabled = enable
if self.enabled then
-- Enabling the mode
self:BindContextActions()
else
-- Disabling
-- Restore mouse cursor
if Mouse.Icon~="" then
Mouse.Icon = ""
end
self:UnbindContextActions()
-- If the mode is disabled while being used, fire the event to toggle it off
if self.isMouseLocked then
self.mouseLockToggledEvent:Fire()
end
self.isMouseLocked = false
end
end
end
return MouseLockController
|
-- go |
OldPos = torsoPos
hum:MoveTo(targpos + Vector3.new(math.random(4,10), math.random(4,10), math.random(4,10)), targ) -- MoveToward Target
|
----- Script ----- |
Button.Activated:Connect(function()
Events.BoneEvent:FireServer()
Frame.Visible = false
end)
|
--- |
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Seashell",Paint)
end)
|
-------------------------------------------------------------------------- |
function Explode() --This function makes the plane explode
if Crashed.Value == false then
Crashed.Value = true
Plane:BreakJoints()
local Explosion = Instance.new("Explosion")
Explosion.Parent = game.Workspace
Explosion.Position = Engine.Position
Explosion.BlastRadius = Plane:GetModelSize().magnitude --This makes the BlastRadius the size of the plane
Explosion.BlastPressure = 200000
if Engine:findFirstChild("Thrust") then Engine.Thrust:remove() end
if Engine:findFirstChild("Direction") then Engine.Direction:remove() end
coroutine.resume(coroutine.create(function()
wait(5)
Plane:Destroy()
end))
end
end
function GetPlaneParts(Model) --This function gets all the parts on the plane
for _,v in pairs(Model:GetChildren()) do
if (v:IsA("BasePart")) then
table.insert(Parts,v) --This inserts all the parts into the "Parts" table
end
GetPlaneParts(v)
end
end
function onAutoCrash() --This function is activated when the AutoCrash value becomes true
if AutoCrash.Value == true then
Plane:BreakJoints()
Explode()
Engine.Thrust:remove()
Engine.Direction:remove()
end
end
function DetectExplosions(Object) --This is a function that I created which detects explosions in the workspace
if Object.ClassName == "Explosion" then --If the object detected was an explosion...
if Object.BlastPressure > 0 then
Object.Hit:connect(function(HitPart,Distance)
if HitPart == Engine then
if Crashed.Value == false then
Explode()
end
end
end)
end
end
end
GetPlaneParts(Plane) --This activates the "GetPlaneParts" function
for _,v in pairs(Parts) do --This gets all the parts in the "Parts" table
v.Touched:connect(function(Object) --This is activated if any of the bricks are touched
if (not Ejected.Value) then
if CanCrash.Value == true then
if Crashed.Value == false then
if (not Object:IsDescendantOf(Plane)) then
if Object.CanCollide == true
and Object.Transparency ~= 1 then --This prevents your from crashing because your flares hit you
if (Object:findFirstChild("PlaneTag") and Object.PlaneTag.Value ~= Plane)
or (not Object:findFirstChild("PlaneTag")) then
if ((Engine.Velocity.magnitude) >= Force.Value) then --If that part is going faster than the Force speed...
local Player = game.Players:GetPlayerFromCharacter(Plane.Parent)
local PlaneTool = Player.Backpack:findFirstChild("Plane")
if PlaneTool then
PlaneTool.Deselect0.Value = true
end
wait(0.01)
Explode()
end
end
end
end
end
end
elseif Ejected.Value then
if Crashed.Value == false then
if (not Object:IsDescendantOf(Plane)) then
if Object.CanCollide and Object.Transparency ~= 1 then
local PlaneTag = Object:findFirstChild("PlaneTag")
if (PlaneTag and PlaneTag.Value ~= Plane) or (not PlaneTag) then
if Object.Parent.Name ~= "EjectorSeat" then
if (not game:GetService("Players"):GetPlayerFromCharacter(Object.Parent)) then
local Player = game.Players:GetPlayerFromCharacter(Plane.Parent)
local PlaneTool = Player.Backpack:findFirstChild("Plane")
if PlaneTool then
PlaneTool.Deselect0.Value = true
end
wait(0.01)
Explode()
end
end
end
end
end
end
end
end)
end
game.Workspace.DescendantAdded:connect(DetectExplosions) --The detect explosions is a childadded function
AutoCrash.Changed:connect(onAutoCrash) --Pretty self explanatory. When the AutoCrash value is changed, the "onAutoCrash" function is activated
|
--game.ReplicatedFirst:RemoveDefaultLoadingScreen() | |
--// Damage Settings |
BaseDamage = 79; -- Torso Damage
LimbDamage = 53; -- Arms and Legs
ArmorDamage = 53; -- How much damage is dealt against armor (Name the armor "Armor")
HeadDamage = 107; -- If you set this to 100, there's a chance the player won't die because of the heal script
|
--[[
Package link auto-generated by Rotriever
]] |
local PackageIndex = script.Parent._Index
local Package = require(PackageIndex["t"]["t"])
return Package
|
--use this to determine if you want this human to be harmed or not, returns boolean |
function checkTeams(otherHuman)
return not (sameTeam(otherHuman) and not FriendlyFire)
end
function getKnife()
local knife = Handle:clone()
knife.Transparency = 0
knife.Hit.Pitch = math.random(90, 110)/100
local lift = Instance.new("BodyForce")
lift.force = Vector3.new(0, 196.2, 0) * knife:GetMass() * 0.8
lift.Parent = knife
local proj = Tool.Projectile:Clone()
proj.Disabled = false
proj.Parent = knife
return knife
end
function equippedLoop()
while Equipped do
local dt = Heartbeat:wait()
if AttackPower < 1 then
AttackPower = AttackPower + dt * AttackRecharge
if AttackPower > 1 then
AttackPower = 1
end
end
Handle.Transparency = 1 - AttackPower
end
end
function onLeftDown(mousePos)
local knife = getKnife()
knife.CFrame = CFrame.new(Handle.Position, mousePos)
knife.Velocity = knife.CFrame.lookVector * AttackSpeed * AttackPower
local damage = AttackDamage * AttackPower
local touched
touched = knife.Touched:connect(function(part)
if part:IsDescendantOf(Tool.Parent) then return end
if contains(Knives, part) then return end
if part.Parent and part.Parent:FindFirstChild("Humanoid") then
local human = part.Parent.Humanoid
if checkTeams(human) then
tagHuman(human)
human:TakeDamage(damage)
knife.Hit:Play()
end
end
knife.Projectile:Destroy()
local w = Instance.new("Weld")
w.Part0 = part
w.Part1 = knife
w.C0 = part.CFrame:toObjectSpace(knife.CFrame)
w.Parent = w.Part0
touched:disconnect()
end)
table.insert(Knives, knife)
knife.Parent = workspace
game:GetService("Debris"):AddItem(knife, 35.5)
delay(25, function()
knife.Transparency = 1
end)
Remote:FireClient(getPlayer(), "PlayAnimation", "Throw")
Handle.Throw.Pitch = 0.8 + 0.4 * AttackPower
Handle.Throw:Play()
AttackPower = 0
end
function onRemote(player, func, ...)
if player ~= getPlayer() then return end
if func == "LeftDown" then
onLeftDown(...)
end
end
function onEquip()
Equipped = true
equippedLoop()
end
function onUnequip()
Equipped = false
end
Remote.OnServerEvent:connect(onRemote)
Tool.Equipped:connect(onEquip)
Tool.Unequipped:connect(onUnequip)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.