prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--//Setup//--
|
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)
|
--Remove with FFlagPlayerScriptsBindAtPriority
|
function BaseCamera:OnKeyDown(input, processed)
if not self.hasGameLoaded and VRService.VREnabled then
return
end
if processed then
return
end
if self.distanceChangeEnabled then
if input.KeyCode == Enum.KeyCode.I then
self:SetCameraToSubjectDistance( self.currentSubjectDistance - 5 )
elseif input.KeyCode == Enum.KeyCode.O then
self:SetCameraToSubjectDistance( self.currentSubjectDistance + 5 )
end
end
if self.panBeginLook == nil and self.keyPanEnabled then
if input.KeyCode == Enum.KeyCode.Left then
self.turningLeft = true
elseif input.KeyCode == Enum.KeyCode.Right then
self.turningRight = true
elseif input.KeyCode == Enum.KeyCode.Comma then
local angle = Util.RotateVectorByAngleAndRound(self:GetCameraLookVector() * Vector3.new(1,0,1), -math.pi*0.1875, math.pi*0.25)
if angle ~= 0 then
self.rotateInput = self.rotateInput + Vector2.new(angle, 0)
self.lastUserPanCamera = tick()
self.lastCameraTransform = nil
end
elseif input.KeyCode == Enum.KeyCode.Period then
local angle = Util.RotateVectorByAngleAndRound(self:GetCameraLookVector() * Vector3.new(1,0,1), math.pi*0.1875, math.pi*0.25)
if angle ~= 0 then
self.rotateInput = self.rotateInput + Vector2.new(angle, 0)
self.lastUserPanCamera = tick()
self.lastCameraTransform = nil
end
elseif input.KeyCode == Enum.KeyCode.PageUp then
self.rotateInput = self.rotateInput + Vector2.new(0,math.rad(15))
self.lastCameraTransform = nil
elseif input.KeyCode == Enum.KeyCode.PageDown then
self.rotateInput = self.rotateInput + Vector2.new(0,math.rad(-15))
self.lastCameraTransform = nil
end
end
end
|
--[[Here are some suggested ID's for you, Note these are mostly club/Dubstep songs
1.145060711
2.146180801
3.152357361
4.152357361
5.145579822
6.148492408
7.142720946
8.142372565
9.152779074
10.145915908
11.138855854
--]]
| |
--Purchase and receive gamepasses
|
main.marketplaceService.PromptGamePassPurchaseFinished:Connect(function(player,assetId,isPurchased)
local pdata = main.pd[player]
if isPurchased and pdata then
local validGamepass = main.permissions.gamepasses[tostring(assetId)]
if validGamepass and not main:GetModule("cf"):FindValue(pdata.Gamepasses, assetId) then
main:GetModule("PlayerData"):InsertStat(player, "Gamepasses", assetId)
main:GetModule("cf"):RankPlayerSimple(player, validGamepass.Rank)
if not main:GetModule("cf"):FindValue(main.products, assetId) then
main:GetModule("cf"):FormatAndFireNotice(player, "UnlockRank", main:GetModule("cf"):GetRankName(validGamepass.Rank))
end
main:GetModule("cf"):CheckAndRankToDonor(player, pdata, assetId)
end
end
end)
return module
|
-- ====================
-- CAMERA SHAKING
-- Make user's camera shaking when shooting
-- ====================
|
CameraShakingEnabled = true;
Intensity = 0.5; --In degree
|
-- Set up the event handler for the GClippsly button
|
btn.MouseButton1Click:Connect(toggleWindow)
|
-- ProfileVersionQuery object:
|
local ProfileVersionQuery = {
--[[
_profile_store = profile_store,
_profile_key = profile_key,
_sort_direction = sort_direction,
_min_date = min_date,
_max_date = max_date,
_query_pages = pages, -- [DataStoreVersionPages]
_query_index = index, -- [number]
_query_failure = false,
_is_query_yielded = false,
_query_queue = {},
--]]
}
ProfileVersionQuery.__index = ProfileVersionQuery
function ProfileVersionQuery:_MoveQueue()
while #self._query_queue > 0 do
local queue_entry = table.remove(self._query_queue, 1)
task.spawn(queue_entry)
if self._is_query_yielded == true then
break
end
end
end
function ProfileVersionQuery:NextAsync(_is_stacking) --> [Profile] or nil
if self._profile_store == nil then
return nil
end
local profile
local is_finished = false
local function query_job()
if self._query_failure == true then
is_finished = true
return
end
-- First "next" call loads version pages:
if self._query_pages == nil then
self._is_query_yielded = true
task.spawn(function()
profile = self:NextAsync(true)
is_finished = true
end)
local list_success, error_message = pcall(function()
self._query_pages = self._profile_store._global_data_store:ListVersionsAsync(
self._profile_key,
self._sort_direction,
self._min_date,
self._max_date
)
self._query_index = 0
end)
if list_success == false or self._query_pages == nil then
warn("[ProfileService]: Version query fail - " .. tostring(error_message))
self._query_failure = true
end
self._is_query_yielded = false
self:_MoveQueue()
return
end
local current_page = self._query_pages:GetCurrentPage()
local next_item = current_page[self._query_index + 1]
-- No more entries:
if self._query_pages.IsFinished == true and next_item == nil then
is_finished = true
return
end
-- Load next page when this page is over:
if next_item == nil then
self._is_query_yielded = true
task.spawn(function()
profile = self:NextAsync(true)
is_finished = true
end)
local success = pcall(function()
self._query_pages:AdvanceToNextPageAsync()
self._query_index = 0
end)
if success == false or #self._query_pages:GetCurrentPage() == 0 then
self._query_failure = true
end
self._is_query_yielded = false
self:_MoveQueue()
return
end
-- Next page item:
self._query_index += 1
profile = self._profile_store:ViewProfileAsync(self._profile_key, next_item.Version)
is_finished = true
end
if self._is_query_yielded == false then
query_job()
else
if _is_stacking == true then
table.insert(self._query_queue, 1, query_job)
else
table.insert(self._query_queue, query_job)
end
end
while is_finished == false do
task.wait()
end
return profile
end
|
--watch the video to know where to put it
|
local repStorage = game:GetService("ReplicatedStorage")
local remote = repStorage:FindFirstChild("Rebirth")
local button = script.Parent
local debounce = false
button.MouseButton1Click:Connect(function()
local rebirths = game.Players.LocalPlayer.leaderstats:FindFirstChild("Rebirths")
if not debounce then
debounce = true
local playerPoint = rebirths
remote:FireServer(playerPoint)
wait(0.001)
debounce = false
end
end)
repeat
local rebirths = game.Players.LocalPlayer.leaderstats:FindFirstChild("Rebirths")
local textButton = script.Parent
textButton.Text = "".. tostring(1000000 * (rebirths.Value + 1)) .." Cash "
wait(0.001)
until script.Parent == nil
|
--[[
INSTRUCTIONS: Place both teleporter1a and teleporter1b in the same directory
(e.g. both in workspace directly, or both directly in the same group or model)
Otherwise it wont work. Once youve done that, jump on the teleporter to teleport to the other.
If you want more than one set of teleporters I will be adding more types in the future.
Send me requests and ideas - miked.
--]]
| |
--!strict
|
local RunService = game:GetService("RunService")
local PostSimulation = RunService.Heartbeat
local OPT_INTERVAL_ATTRIBUTE = "Interval"
local OPT_INTERVAL = 3
local OPT_SWITCH_ATTRIBUTE = "Switch"
local OPT_SWITCH = false
local OPT_DEFAULT_MATERIAL = Enum.Material.SmoothPlastic
local OPT_SWITCH_MATERIAL = Enum.Material.ForceField
local Obstacle = {}
Obstacle.__index = Obstacle
function Obstacle.new(instance: Instance)
local self = setmetatable({}, Obstacle)
self._events = {}
self._materialCache = {}
self._lastTick = tick()
self._instance = instance
self._interval = instance:GetAttribute(OPT_INTERVAL_ATTRIBUTE) or OPT_INTERVAL
self._switch = instance:GetAttribute(OPT_SWITCH_ATTRIBUTE) or OPT_SWITCH
self:CachePartMaterials()
table.insert(self._events, PostSimulation:Connect(function()
local now = tick()
if now - self._lastTick < self._interval then
return
end
self._lastTick = now
self:ToggleState()
end))
self:UpdateParts()
return self
end
function Obstacle:GetAllParts(): {BasePart}
local parts = {}
if self._instance:IsA("BasePart") then
table.insert(parts, self._instance::BasePart)
end
for _, child: BasePart in ipairs(self._instance:GetDescendants()) do
if child:IsA("BasePart") then
table.insert(parts, child)
end
end
return parts
end
function Obstacle:CachePartMaterials()
for _, part: BasePart in ipairs(self:GetAllParts()) do
self._materialCache[part] = part.Material
end
end
function Obstacle:GetSwitchState(): boolean
return self._instance:GetAttribute(OPT_SWITCH_ATTRIBUTE) == true
end
function Obstacle:ToggleState()
self._instance:SetAttribute(OPT_SWITCH_ATTRIBUTE, not self:GetSwitchState())
self:UpdateParts()
end
function Obstacle:UpdateParts()
for _, part in ipairs(self:GetAllParts()) do
self:SetPartMaterial(part)
end
end
function Obstacle:SetPartMaterial(part: BasePart)
local switch = self:GetSwitchState()
part.CanCollide = switch
part.Material = switch and (self._materialCache[part] or OPT_DEFAULT_MATERIAL) or
OPT_SWITCH_MATERIAL
end
function Obstacle:Destroy()
for _, event: RBXScriptConnection in ipairs(self._events) do
event:Disconnect()
end
end
return Obstacle
|
-- Create component
|
local TextBox = Roact.PureComponent:extend 'TextBox'
|
-- Encuentra el sonido llamado "hyperx" en el servicio de sonido
|
local sound = soundService:FindFirstChild("final")
|
--
|
tool.Equipped:connect(function()
equipped = true
owner = game:GetService("Players"):GetPlayerFromCharacter(tool.Parent)
character = owner.Character
local rightarm = Instance.new("Weld", character.Torso)
rightarm.Part0 = character.Torso
rightarm.Part1 = character["Right Arm"]
rightarm.C0 = CFrame.new(1.5,0,0)
rightarm.Name = "RightArmWeldpunch"
local leftarm = Instance.new("Weld", character.Torso)
leftarm.Part0 = character.Torso
leftarm.Part1 = character["Left Arm"]
leftarm.C0 = CFrame.new(-1.5,0,0)
leftarm.Name = "LeftArmWeldpunch"
local head = Instance.new("Weld", character.Torso)
head.Part0 = character.Torso
head.Part1 = character.Head
head.C0 = CFrame.new(0,1.5,0)
head.Name = "HeadWeldpunch"
local humanoidrootpart = Instance.new("Weld", character.HumanoidRootPart)
humanoidrootpart.Part0 = character.HumanoidRootPart
humanoidrootpart.Part1 = character.Torso
humanoidrootpart.Name = "HumanoidRootPartWeldpunch"
for i,v in pairs(script:GetChildren()) do
if v.ClassName == "Sound" then
v.Parent = character.HumanoidRootPart
end
end
cananimate = true
local savedchar = character
local lasthp = character:findFirstChildOfClass("Humanoid").Health
coroutine.wrap(function()
local humhp = character:findFirstChildOfClass("Humanoid").Health
while runservice.Stepped:wait() and equipped do
if character:findFirstChildOfClass("Humanoid").Health < humhp then
local thedamage = humhp - character:findFirstChildOfClass("Humanoid").Health
character:findFirstChildOfClass("Humanoid").Health = character:findFirstChildOfClass("Humanoid").Health + thedamage/2.5
end
if cananimate then
head.C0 = head.C0:lerp(CFrame.new(0,1.5,0),0.1)
humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(),0.2)
leftarm.C0 = leftarm.C0:lerp(CFrame.new(-0.8,0.15,-0.5) * CFrame.fromEulerAnglesXYZ(math.pi-(math.rad(20)),0,math.rad(15)) * CFrame.new(0,-0.5,0),0.2)
rightarm.C0 = rightarm.C0:lerp(CFrame.new(0.8,0.15,-0.5) * CFrame.fromEulerAnglesXYZ(math.pi-(math.rad(20)),0,math.rad(-15)) * CFrame.new(0,-0.5,0),0.2)
end
humhp = character:findFirstChildOfClass("Humanoid").Health
end
end)()
end)
tool.Unequipped:connect(function()
equipped = false
instancewhitelist = {}
mouseclick = false
cananimate = false
for i,v in pairs(character.HumanoidRootPart:GetChildren()) do
if v.ClassName == "Sound" then
v.Parent = script
end
end
if character.Torso:findFirstChild("LeftArmWeldpunch") then
character.Torso:findFirstChild("LeftArmWeldpunch"):destroy()
end
if character.Torso:findFirstChild("RightArmWeldpunch") then
character.Torso:findFirstChild("RightArmWeldpunch"):destroy()
end
if character.Torso:findFirstChild("HeadWeldpunch") then
character.Torso:findFirstChild("HeadWeldpunch"):destroy()
end
if character:findFirstChild("HumanoidRootPart") then
if character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeldpunch") then
character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeldpunch"):destroy()
end
end
end)
|
-- Displays a hint to the player that the GUI auto-hides.
--
-- ForbiddenJ
|
IsGuiDisplayed = script.Parent.IsDisplayed
IsHiddenByOtherGUI = script.Parent.IsHiddenByOtherGUI
SpawnNotification = game.ReplicatedStorage.ClientStorage.SpawnNotification
SmallHint = script.Parent.SmallHint
HasShownLargeHint = false
function Update()
SmallHint.Visible = not IsGuiDisplayed.Value
if not HasShownLargeHint and not IsGuiDisplayed.Value and not IsHiddenByOtherGUI.Value then
HasShownLargeHint = true
local notification =
SpawnNotification:Invoke("Hover mouse to show panel.", nil, -1)
SmallHint.ImageTransparency = 0
notification.TextStrokeColor3 = Color3.new(0.7, 0.7, 0.7)
local tween = game.TweenService:Create(
SmallHint,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, math.huge),
{ImageTransparency = 0.85})
tween.Parent = SmallHint
tween:Play()
local tween2 = game.TweenService:Create(
notification,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, math.huge),
{TextStrokeColor3 = Color3.new(0, 0, 0)})
tween2.Parent = notification
tween2:Play()
local hintCleanedUp = false
local function cleanupHint()
if not hintCleanedUp then
if notification.Parent ~= nil then
notification.LifetimeLeft.Value = 0
end
tween:Cancel()
tween:Destroy()
SmallHint.ImageTransparency = 0.85
hintCleanedUp = true
end
end
delay(10, cleanupHint)
IsGuiDisplayed.Changed:Wait()
cleanupHint()
end
end
IsGuiDisplayed.Changed:Connect(Update)
Update()
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = {};
local v2 = require(game.ReplicatedStorage.Modules.Lightning);
local v3 = require(game.ReplicatedStorage.Modules.Xeno);
local v4 = require(game.ReplicatedStorage.Modules.CameraShaker);
local l__TweenService__5 = game.TweenService;
local l__Debris__6 = game.Debris;
local l__ReplicatedStorage__1 = game.ReplicatedStorage;
function v1.RunStompFx(p1, p2, p3, p4)
local v7 = {};
for v8 = 1, 15 do
local v9 = l__ReplicatedStorage__1.KillFX[p1].Gate:Clone();
v9.Parent = workspace.Ignored.Animations;
local l__p__10 = p2.Parent.UpperTorso.CFrame.p;
game.Debris:AddItem(v9, 6);
v9.CFrame = CFrame.new(l__p__10.X + math.random(-35, 35), l__p__10.Y + math.random(17, 35), l__p__10.Z + math.random(-35, 35));
v9.CFrame = CFrame.lookAt(v9.Position, p2.Position);
table.insert(v7, v9);
local v11 = math.random(-360, 360);
v9.Middle.Cut.Rotation = NumberRange.new(v11, v11);
task.delay(0.15, function()
v9.Middle.Cut.Enabled = false;
v9.Attachment.Effect.Enabled = true;
v9.FF.Enabled = true;
v9.Sound:Play();
end);
task.wait(0.06);
end;
local v12 = {};
for v13, v14 in pairs(v7) do
local v15 = l__ReplicatedStorage__1.KillFX[p1].Sword:Clone();
v15.Parent = workspace.Ignored.Animations;
game.Debris:AddItem(v15, 5);
v15.CFrame = v14.CFrame * CFrame.new(0, 0, -1) * CFrame.Angles(-1.5707963267948966, math.rad(math.random(-360, 360)), 0);
game.TweenService:Create(v15, TweenInfo.new(1, Enum.EasingStyle.Quint), {
Size = v15.F.Value,
CFrame = v14.CFrame * CFrame.new(0, 0, -3) * CFrame.Angles(-1.5707963267948966, math.rad(math.random(-360, 360)), 0)
}):Play();
table.insert(v12, v15);
task.wait(0.04);
end;
task.wait(0.25);
for v16, v17 in pairs(v7) do
v17.FF.Enabled = false;
v17.Attachment.Effect.Enabled = false;
end;
for v18, v19 in pairs(v12) do
v19[math.random(1, 3)]:Play();
local l__Position__20 = v19.Position;
game.TweenService:Create(v19, TweenInfo.new(0.65, Enum.EasingStyle.Quint), {
Position = (CFrame.new(p2.Position) * CFrame.new(0, math.random(-0.9, 0.1), 0)).Position
}):Play();
task.delay(1, function()
v19.Charge.Enabled = false;
game.TweenService:Create(v19, TweenInfo.new(1, Enum.EasingStyle.Quint), {
Transparency = 1
}):Play();
end);
task.wait(0.025);
end;
return nil;
end;
return v1;
|
-- ROBLOX TODO: add type constraint <EachCallback extends Global.TestCallback>
|
local function default<EachCallback>(cb_: GlobalCallback?, supportsDone_: boolean?)
local supportsDone = if supportsDone_ ~= nil then supportsDone_ else true
local cb = cb_ or unavailableFn
return function(
table_: Global_EachTable,
...: any --[[ ROBLOX comment: Upstream type: <Global.TemplateData> (Array<unknown>) ]]
)
local taggedTemplateData = if select("#", ...) > 0 then { ... } else {}
local function eachBind(title: string, test: Global_EachTestFn<EachCallback>, timeout: number?): ()
local ok, result = pcall(function()
local tests = if isArrayTable(taggedTemplateData)
then buildArrayTests(title, table_)
else buildTemplateTests(title, table_, taggedTemplateData)
return Array.forEach(tests, function(row)
-- ROBLOX FIXME Luau: supports done is known to be a boolean at this point
return cb(row.title, applyArguments(supportsDone, row.arguments, test), timeout)
end) :: any
end)
if not ok then
local error_ = ErrorWithStack.new(result.message, eachBind)
return cb(title, function()
error(error_)
end)
end
return result
end
return eachBind
end
end
exports.default = default
function isArrayTable(data: Global_TemplateData)
return #data == 0
end
function buildArrayTests(title: string, table_: Global_EachTable): EachTests
validateArrayTable(table_)
return convertArrayTable(title, table_ :: Global_ArrayTable)
end
function buildTemplateTests(title: string, table_: Global_EachTable, taggedTemplateData: Global_TemplateData): EachTests
local headings = getHeadingKeys((table_ :: Array<string>)[1] :: string)
validateTemplateTableArguments(headings, taggedTemplateData)
return convertTemplateTable(title, headings, taggedTemplateData)
end
function getHeadingKeys(headings: string): Array<string>
return String.split(extractValidTemplateHeadings(headings):gsub("%s+", ""), "|")
end
|
--[=[
@type ServerMiddleware {ServerMiddlewareFn}
@within KnitServer
An array of server middleware functions.
]=]
|
type ServerMiddleware = {ServerMiddlewareFn}
|
--Code--
|
local function PlayerTouched(Part)
local Parent = Part.Parent
if game.Players:GetPlayerFromCharacter(Parent) then
Parent.Humanoid.Health = 1
Parent.Humanoid.Walkspeed = 5
wait(7.5)
Parent.Humanoid.Walkspeed = 12
wait(7.5)
Parent.Humanoid.Walkspeed = 16
end
end
Brick.Touched:connect(PlayerTouched)
|
-- print("Wha " .. pose)
|
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
if (setAngles) then
desiredAngle = amplitude * math.sin(time * frequency)
RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
RightHip:SetDesiredAngle(-desiredAngle)
LeftHip:SetDesiredAngle(-desiredAngle)
end
-- Tool Animation handling
local tool = getTool()
if tool then
animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
stopToolAnimations()
toolAnim = "None"
toolAnimTime = 0
end
end
|
--[[Steering]]
|
Tune.SteerInner = 49 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 50 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .02 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .1 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 150 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- 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
|
--Preforms a "soft shutdown". It will teleport players to a reserved server
--and teleport them back, with a new server. ORiginal version by Merely.
--Be aware this will hard shutdown reserved servers.
|
local PlaceId = game.PlaceId
local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local TeleportScreenCreator = script:WaitForChild("TeleportScreenCreator")
local CreateTeleportScreen = require(TeleportScreenCreator)
local SoftShutdownLocalScript = script:WaitForChild("SoftShutdownLocalScript")
TeleportScreenCreator.Parent = SoftShutdownLocalScript
SoftShutdownLocalScript.Parent = game:GetService("ReplicatedFirst")
local StartShutdown = Instance.new("RemoteEvent")
StartShutdown.Name = "StartShutdown"
StartShutdown.Parent = game.ReplicatedStorage
if not (game.VIPServerId ~= "" and game.VIPServerOwnerId == 0) then
--If it is not a reserved server, bind the teleporting on close.
game:BindToClose(function()
--Return if there is no players.
if #game.Players:GetPlayers() == 0 then
return
end
--Return if the server instance is offline.
if game.JobId == "" then
return
end
--Send the shutdown message.
StartShutdown:FireAllClients(true)
wait(2)
local ReservedServerCode = TeleportService:ReserveServer(PlaceId)
--Create the teleport GUI.
local ScreenGui = CreateTeleportScreen()
local function TeleportPlayer(Player)
TeleportService:TeleportToPrivateServer(PlaceId,ReservedServerCode,{Player},nil,{IsTemporaryServer=true,PlaceId = PlaceId},ScreenGui)
end
--Teleport players and try to keep the server alive until all players leave.
for _,Player in pairs(Players:GetPlayers()) do
TeleportPlayer(Player)
end
game.Players.PlayerAdded:connect(TeleportPlayer)
while #Players:GetPlayers() > 0 do wait() end
end)
end
|
-- Inserts `v` into `t` at `i`. Also sets `Index` field in `v`.
|
local function insert(t,i,v)
for n = #t,i,-1 do
local v = t[n]
v.Index = n+1
t[n+1] = v
end
v.Index = i
t[i] = v
end
|
-- Listener for changes to workspace.CurrentCamera
|
function BaseCamera:OnCurrentCameraChanged()
if UserInputService.TouchEnabled then
if self.viewportSizeChangedConn then
self.viewportSizeChangedConn:Disconnect()
self.viewportSizeChangedConn = nil
end
local newCamera = game.Workspace.CurrentCamera
if newCamera then
self:OnViewportSizeChanged()
self.viewportSizeChangedConn = newCamera:GetPropertyChangedSignal("ViewportSize"):Connect(function()
self:OnViewportSizeChanged()
end)
end
end
-- VR support additions
if self.cameraSubjectChangedConn then
self.cameraSubjectChangedConn:Disconnect()
self.cameraSubjectChangedConn = nil
end
local camera = game.Workspace.CurrentCamera
if camera then
self.cameraSubjectChangedConn = camera:GetPropertyChangedSignal("CameraSubject"):Connect(function()
self:OnNewCameraSubject()
end)
self:OnNewCameraSubject()
end
end
function BaseCamera:OnDynamicThumbstickEnabled()
if UserInputService.TouchEnabled then
self.isDynamicThumbstickEnabled = true
end
end
function BaseCamera:OnDynamicThumbstickDisabled()
self.isDynamicThumbstickEnabled = false
end
function BaseCamera:OnGameSettingsTouchMovementModeChanged()
if player.DevTouchMovementMode == Enum.DevTouchMovementMode.UserChoice then
if (UserGameSettings.TouchMovementMode == Enum.TouchMovementMode.DynamicThumbstick
or UserGameSettings.TouchMovementMode == Enum.TouchMovementMode.Default) then
self:OnDynamicThumbstickEnabled()
else
self:OnDynamicThumbstickDisabled()
end
end
end
function BaseCamera:OnDevTouchMovementModeChanged()
if player.DevTouchMovementMode.Name == "DynamicThumbstick" then
self:OnDynamicThumbstickEnabled()
else
self:OnGameSettingsTouchMovementModeChanged()
end
end
function BaseCamera:OnPlayerCameraPropertyChange()
-- This call forces re-evaluation of player.CameraMode and clamping to min/max distance which may have changed
self:SetCameraToSubjectDistance(self.currentSubjectDistance)
end
function BaseCamera:GetCameraHeight()
if VRService.VREnabled and not self.inFirstPerson then
return math.sin(VR_ANGLE) * self.currentSubjectDistance
end
return 0
end
function BaseCamera:InputTranslationToCameraAngleChange(translationVector, sensitivity)
if not FFlagUserDontAdjustSensitvityForPortrait then
local camera = game.Workspace.CurrentCamera
if camera and camera.ViewportSize.X > 0 and camera.ViewportSize.Y > 0 and (camera.ViewportSize.Y > camera.ViewportSize.X) then
-- Screen has portrait orientation, swap X and Y sensitivity
return translationVector * Vector2.new( sensitivity.Y, sensitivity.X)
end
end
return translationVector * sensitivity
end
function BaseCamera:Enable(enable)
if self.enabled ~= enable then
self.enabled = enable
if self.enabled then
self:ConnectInputEvents()
self:BindContextActions()
if player.CameraMode == Enum.CameraMode.LockFirstPerson then
self.currentSubjectDistance = 0.5
if not self.inFirstPerson then
self:EnterFirstPerson()
end
end
else
self:DisconnectInputEvents()
self:UnbindContextActions()
-- Clean up additional event listeners and reset a bunch of properties
self:Cleanup()
end
end
end
function BaseCamera:GetEnabled()
return self.enabled
end
function BaseCamera:OnInputBegan(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
self:OnTouchBegan(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
self:OnMouse2Down(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton3 then
self:OnMouse3Down(input, processed)
end
end
function BaseCamera:OnInputChanged(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
self:OnTouchChanged(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseMovement then
self:OnMouseMoved(input, processed)
end
end
function BaseCamera:OnInputEnded(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
self:OnTouchEnded(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
self:OnMouse2Up(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton3 then
self:OnMouse3Up(input, processed)
end
end
function BaseCamera:OnPointerAction(wheel, pan, pinch, processed)
if processed then
return
end
if pan.Magnitude > 0 then
local inversionVector = Vector2.new(1, UserGameSettings:GetCameraYInvertValue())
local rotateDelta = self:InputTranslationToCameraAngleChange(PAN_SENSITIVITY*pan, MOUSE_SENSITIVITY)*inversionVector
self.rotateInput = self.rotateInput + rotateDelta
end
local zoom = self.currentSubjectDistance
local zoomDelta = -(wheel + pinch)
if abs(zoomDelta) > 0 then
local newZoom
if self.inFirstPerson and zoomDelta > 0 then
newZoom = FIRST_PERSON_DISTANCE_THRESHOLD
else
newZoom = zoom + zoomDelta*(1 + zoom*ZOOM_SENSITIVITY_CURVATURE)
end
self:SetCameraToSubjectDistance(newZoom)
end
end
function BaseCamera:ConnectInputEvents()
self.pointerActionConn = UserInputService.PointerAction:Connect(function(wheel, pan, pinch, processed)
self:OnPointerAction(wheel, pan, pinch, processed)
end)
self.inputBeganConn = UserInputService.InputBegan:Connect(function(input, processed)
self:OnInputBegan(input, processed)
end)
self.inputChangedConn = UserInputService.InputChanged:Connect(function(input, processed)
self:OnInputChanged(input, processed)
end)
self.inputEndedConn = UserInputService.InputEnded:Connect(function(input, processed)
self:OnInputEnded(input, processed)
end)
self.menuOpenedConn = GuiService.MenuOpened:connect(function()
self:ResetInputStates()
end)
self.gamepadConnectedConn = UserInputService.GamepadDisconnected:connect(function(gamepadEnum)
if self.activeGamepad ~= gamepadEnum then return end
self.activeGamepad = nil
self:AssignActivateGamepad()
end)
self.gamepadDisconnectedConn = UserInputService.GamepadConnected:connect(function(gamepadEnum)
if self.activeGamepad == nil then
self:AssignActivateGamepad()
end
end)
self:AssignActivateGamepad()
if not FFlagUserCameraToggle then
self:UpdateMouseBehavior()
end
end
function BaseCamera:BindContextActions()
self:BindGamepadInputActions()
self:BindKeyboardInputActions()
end
function BaseCamera:AssignActivateGamepad()
local connectedGamepads = UserInputService:GetConnectedGamepads()
if #connectedGamepads > 0 then
for i = 1, #connectedGamepads do
if self.activeGamepad == nil then
self.activeGamepad = connectedGamepads[i]
elseif connectedGamepads[i].Value < self.activeGamepad.Value then
self.activeGamepad = connectedGamepads[i]
end
end
end
if self.activeGamepad == nil then -- nothing is connected, at least set up for gamepad1
self.activeGamepad = Enum.UserInputType.Gamepad1
end
end
function BaseCamera:DisconnectInputEvents()
if self.inputBeganConn then
self.inputBeganConn:Disconnect()
self.inputBeganConn = nil
end
if self.inputChangedConn then
self.inputChangedConn:Disconnect()
self.inputChangedConn = nil
end
if self.inputEndedConn then
self.inputEndedConn:Disconnect()
self.inputEndedConn = nil
end
end
function BaseCamera:UnbindContextActions()
for i = 1, #self.boundContextActions do
ContextActionService:UnbindAction(self.boundContextActions[i])
end
self.boundContextActions = {}
end
function BaseCamera:Cleanup()
if self.pointerActionConn then
self.pointerActionConn:Disconnect()
self.pointerActionConn = nil
end
if self.menuOpenedConn then
self.menuOpenedConn:Disconnect()
self.menuOpenedConn = nil
end
if self.mouseLockToggleConn then
self.mouseLockToggleConn:Disconnect()
self.mouseLockToggleConn = nil
end
if self.gamepadConnectedConn then
self.gamepadConnectedConn:Disconnect()
self.gamepadConnectedConn = nil
end
if self.gamepadDisconnectedConn then
self.gamepadDisconnectedConn:Disconnect()
self.gamepadDisconnectedConn = nil
end
if self.subjectStateChangedConn then
self.subjectStateChangedConn:Disconnect()
self.subjectStateChangedConn = nil
end
if self.viewportSizeChangedConn then
self.viewportSizeChangedConn:Disconnect()
self.viewportSizeChangedConn = nil
end
if self.touchActivateConn then
self.touchActivateConn:Disconnect()
self.touchActivateConn = nil
end
self.turningLeft = false
self.turningRight = false
self.lastCameraTransform = nil
self.lastSubjectCFrame = nil
self.userPanningTheCamera = false
self.rotateInput = Vector2.new()
self.gamepadPanningCamera = Vector2.new(0,0)
-- Reset input states
self.startPos = nil
self.lastPos = nil
self.panBeginLook = nil
self.isRightMouseDown = false
self.isMiddleMouseDown = false
self.fingerTouches = {}
self.dynamicTouchInput = nil
self.numUnsunkTouches = 0
self.startingDiff = nil
self.pinchBeginZoom = nil
-- Unlock mouse for example if right mouse button was being held down
if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
|
-- Issue with play solo? (F6)
|
while not UserInputService.KeyboardEnabled and not UserInputService.TouchEnabled and not UserInputService.GamepadEnabled do
wait()
end
|
--// Firemode Functions
|
function CreateBullet(L_203_arg1)
local L_204_ = L_59_.Position
local L_205_ = (L_4_.Hit.p - L_204_).unit
local L_206_ = CFrame.Angles(math.rad(math.random(-L_203_arg1, L_203_arg1)), math.rad(math.random(-L_203_arg1, L_203_arg1)), math.rad(math.random(-L_203_arg1, L_203_arg1)))
L_205_ = L_206_ * L_205_
local L_207_ = CFrame.new(L_204_, L_204_ + L_205_)
local L_208_ = Instance.new("Part", L_104_)
game.Debris:AddItem(L_208_, 10)
L_208_.Shape = Enum.PartType.Ball
L_208_.Size = Vector3.new(1, 1, 12)
L_208_.Name = "Bullet"
L_208_.TopSurface = "Smooth"
L_208_.BottomSurface = "Smooth"
L_208_.BrickColor = BrickColor.new("Bright green")
L_208_.Material = "Neon"
L_208_.CanCollide = false
--Bullet.CFrame = FirePart.CFrame + (Grip.CFrame.p - Grip.CFrame.p)
L_208_.CFrame = L_207_
local L_209_ = Instance.new("Sound")
L_209_.SoundId = "rbxassetid://341519743"
L_209_.Looped = true
L_209_:Play()
L_209_.Parent = L_208_
L_209_.Volume = 0.4
L_209_.MaxDistance = 30
L_208_.Transparency = 1
local L_210_ = L_208_:GetMass()
local L_211_ = Instance.new('BodyForce', L_208_)
if not L_83_ then
L_211_.Force = L_24_.BulletPhysics
L_208_.Velocity = L_205_ * L_24_.BulletSpeed
else
L_211_.Force = L_24_.ExploPhysics
L_208_.Velocity = L_205_ * L_24_.ExploSpeed
end
local L_212_ = Instance.new('Attachment', L_208_)
L_212_.Position = Vector3.new(0.1, 0, 0)
local L_213_ = Instance.new('Attachment', L_208_)
L_213_.Position = Vector3.new(-0.1, 0, 0)
local L_214_ = TracerCalculation()
if L_24_.TracerEnabled == true and L_214_ then
local L_215_ = Instance.new('Trail', L_208_)
L_215_.Attachment0 = L_212_
L_215_.Attachment1 = L_213_
L_215_.Transparency = NumberSequence.new(L_24_.TracerTransparency)
L_215_.LightEmission = L_24_.TracerLightEmission
L_215_.TextureLength = L_24_.TracerTextureLength
L_215_.Lifetime = L_24_.TracerLifetime
L_215_.FaceCamera = L_24_.TracerFaceCamera
L_215_.Color = ColorSequence.new(L_24_.TracerColor.Color)
end
if L_1_:FindFirstChild('Shell') and not L_83_ then
CreateShell()
end
delay(0.2, function()
L_208_.Transparency = 0
end)
return L_208_
end
function CheckForHumanoid(L_216_arg1)
local L_217_ = false
local L_218_ = nil
if L_216_arg1 then
if (L_216_arg1.Parent:FindFirstChild("Humanoid") or L_216_arg1.Parent.Parent:FindFirstChild("Humanoid")) then
L_217_ = true
if L_216_arg1.Parent:FindFirstChild('Humanoid') then
L_218_ = L_216_arg1.Parent.Humanoid
elseif L_216_arg1.Parent.Parent:FindFirstChild('Humanoid') then
L_218_ = L_216_arg1.Parent.Parent.Humanoid
end
else
L_217_ = false
end
end
return L_217_, L_218_
end
function CastRay(L_219_arg1)
local L_220_, L_221_, L_222_
local L_223_ = L_56_.Position;
local L_224_ = L_219_arg1.Position;
local L_225_ = 0
local L_226_ = L_83_
while true do
L_109_:wait()
L_224_ = L_219_arg1.Position;
L_225_ = L_225_ + (L_224_ - L_223_).magnitude
L_220_, L_221_, L_222_ = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_223_, (L_224_ - L_223_)), IgnoreList);
local L_227_ = Vector3.new(0, 1, 0):Cross(L_222_)
local L_228_ = math.asin(L_227_.magnitude) -- division by 1 is redundant
if L_225_ > L_24_.BulletDecay then
L_219_arg1:Destroy()
break
end
if L_220_ and (L_220_ and L_220_.Transparency >= 1 or L_220_.CanCollide == false) and L_220_.Name ~= 'Right Arm' and L_220_.Name ~= 'Left Arm' and L_220_.Name ~= 'Right Leg' and L_220_.Name ~= 'Left Leg' and L_220_.Name ~= 'Armor' then
table.insert(IgnoreList, L_220_)
end
if L_220_ then
L_227_ = Vector3.new(0, 1, 0):Cross(L_222_)
L_228_ = math.asin(L_227_.magnitude) -- division by 1 is redundant
L_121_:FireServer(L_221_)
local L_229_ = CheckForHumanoid(L_220_)
if L_229_ == false then
L_219_arg1:Destroy()
L_116_:FireServer(L_221_, L_227_, L_228_, L_222_, "Part", L_220_)
elseif L_229_ == true then
L_219_arg1:Destroy()
L_116_:FireServer(L_221_, L_227_, L_228_, L_222_, "Human", L_220_)
end
end
if L_220_ and L_226_ then
L_119_:FireServer(L_221_)
end
if L_220_ then
local L_230_, L_231_ = CheckForHumanoid(L_220_)
if L_230_ then
L_114_:FireServer(L_231_)
if L_24_.AntiTK then
if game.Players:FindFirstChild(L_231_.Parent.Name) and game.Players:FindFirstChild(L_231_.Parent.Name).TeamColor ~= L_2_.TeamColor or L_231_.Parent:FindFirstChild('Vars') and game.Players:FindFirstChild(L_231_.Parent:WaitForChild('Vars'):WaitForChild('BotID').Value) and L_2_.TeamColor ~= L_231_.Parent:WaitForChild('Vars'):WaitForChild('teamColor').Value then
if L_220_.Name == 'Head' then
L_113_:FireServer(L_231_, L_24_.HeadDamage)
local L_232_ = L_19_:WaitForChild('BodyHit'):clone()
L_232_.Parent = L_2_.PlayerGui
L_232_:Play()
game:GetService("Debris"):addItem(L_232_, L_232_.TimeLength)
end
if L_220_.Name ~= 'Head' and not (L_220_.Parent:IsA('Accessory') or L_220_.Parent:IsA('Hat')) then
if L_220_.Name ~= 'Torso' and L_220_.Name ~= 'HumanoidRootPart' and L_220_.Name ~= 'Armor' then
L_113_:FireServer(L_231_, L_24_.LimbDamage)
elseif L_220_.Name == 'Torso' or L_220_.Name == 'HumanoidRootPart' and L_220_.Name ~= 'Armor' then
L_113_:FireServer(L_231_, L_24_.BaseDamage)
elseif L_220_.Name == 'Armor' then
L_113_:FireServer(L_231_, L_24_.ArmorDamage)
end
local L_233_ = L_19_:WaitForChild('BodyHit'):clone()
L_233_.Parent = L_2_.PlayerGui
L_233_:Play()
game:GetService("Debris"):addItem(L_233_, L_233_.TimeLength)
end
if (L_220_.Parent:IsA('Accessory') or L_220_.Parent:IsA('Hat')) then
L_113_:FireServer(L_231_, L_24_.HeadDamage)
local L_234_ = L_19_:WaitForChild('BodyHit'):clone()
L_234_.Parent = L_2_.PlayerGui
L_234_:Play()
game:GetService("Debris"):addItem(L_234_, L_234_.TimeLength)
end
end
else
if L_220_.Name == 'Head' then
L_113_:FireServer(L_231_, L_24_.HeadDamage)
local L_235_ = L_19_:WaitForChild('BodyHit'):clone()
L_235_.Parent = L_2_.PlayerGui
L_235_:Play()
game:GetService("Debris"):addItem(L_235_, L_235_.TimeLength)
end
if L_220_.Name ~= 'Head' and not (L_220_.Parent:IsA('Accessory') or L_220_.Parent:IsA('Hat')) then
if L_220_.Name ~= 'Torso' and L_220_.Name ~= 'HumanoidRootPart' and L_220_.Name ~= 'Armor' then
L_113_:FireServer(L_231_, L_24_.LimbDamage)
elseif L_220_.Name == 'Torso' or L_220_.Name == 'HumanoidRootPart' and L_220_.Name ~= 'Armor' then
L_113_:FireServer(L_231_, L_24_.BaseDamage)
elseif L_220_.Name == 'Armor' then
L_113_:FireServer(L_231_, L_24_.ArmorDamage)
end
local L_236_ = L_19_:WaitForChild('BodyHit'):clone()
L_236_.Parent = L_2_.PlayerGui
L_236_:Play()
game:GetService("Debris"):addItem(L_236_, L_236_.TimeLength)
end
if (L_220_.Parent:IsA('Accessory') or L_220_.Parent:IsA('Hat')) then
L_113_:FireServer(L_231_, L_24_.HeadDamage)
local L_237_ = L_19_:WaitForChild('BodyHit'):clone()
L_237_.Parent = L_2_.PlayerGui
L_237_:Play()
game:GetService("Debris"):addItem(L_237_, L_237_.TimeLength)
end
end
end
end
if L_220_ and L_220_.Parent:FindFirstChild("Humanoid") then
return L_220_, L_221_;
end
L_223_ = L_224_;
end
end
function fireSemi()
if L_15_ then
L_69_ = false
Recoiling = true
Shooting = true
--CheckReverb()
if L_54_ then
L_54_:FireServer(L_59_:WaitForChild('Fire').SoundId, L_59_)
else
L_59_:WaitForChild('Fire'):Play()
end
L_112_:FireServer()
L_105_ = CreateBullet(L_24_.BulletSpread)
L_106_ = L_106_ - 1
UpdateAmmo()
RecoilFront = true
local L_238_, L_239_ = spawn(function()
CastRay(L_105_)
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true then
if L_106_ > 0 then
BoltingForwardAnim()
end
end
end)
end
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
wait(L_24_.Firerate)
local L_240_ = JamCalculation()
if L_240_ then
L_69_ = false
else
L_69_ = true
end
Shooting = false
end
end
function fireExplo()
if L_15_ then
L_69_ = false
Recoiling = true
Shooting = true
if L_54_ then
L_54_:FireServer(L_60_:WaitForChild('Fire').SoundId, L_60_)
else
L_60_:WaitForChild('Fire'):Play()
end
L_112_:FireServer()
L_105_ = CreateBullet(L_24_.BulletSpread)
L_108_ = L_108_ - 1
UpdateAmmo()
RecoilFront = true
local L_241_, L_242_ = spawn(function()
CastRay(L_105_)
end)
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
L_69_ = false
Shooting = false
end
end
function fireShot()
if L_15_ then
L_69_ = false
Recoiling = true
Shooting = true
RecoilFront = true
--CheckReverb()
if L_54_ then
L_54_:FireServer(L_59_:WaitForChild('Fire').SoundId, L_59_)
else
L_59_:WaitForChild('Fire'):Play()
end
L_112_:FireServer()
for L_244_forvar1 = 1, L_24_.ShotNum do
spawn(function()
L_105_ = CreateBullet(L_24_.BulletSpread)
end)
local L_245_, L_246_ = spawn(function()
CastRay(L_105_)
end)
end
for L_247_forvar1, L_248_forvar2 in pairs(L_59_:GetChildren()) do
if L_248_forvar2.Name:sub(1, 7) == "FlashFX" then
L_248_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_249_forvar1, L_250_forvar2 in pairs(L_59_:GetChildren()) do
if L_250_forvar2.Name:sub(1, 7) == "FlashFX" then
L_250_forvar2.Enabled = false
end
end
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true then
if L_106_ > 0 then
BoltingForwardAnim()
end
end
end)
end
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
L_106_ = L_106_ - 1
UpdateAmmo()
wait(L_24_.Firerate)
L_76_ = true
BoltBackAnim()
BoltForwardAnim()
IdleAnim()
L_76_ = false
local L_243_ = JamCalculation()
if L_243_ then
L_69_ = false
else
L_69_ = true
end
Shooting = false
end
end
function fireBoltAction()
if L_15_ then
L_69_ = false
Recoiling = true
Shooting = true
--CheckReverb()
if L_54_ then
L_54_:FireServer(L_59_:WaitForChild('Fire').SoundId, L_59_)
else
L_59_:WaitForChild('Fire'):Play()
end
L_112_:FireServer()
L_105_ = CreateBullet(L_24_.BulletSpread)
L_106_ = L_106_ - 1
UpdateAmmo()
RecoilFront = true
local L_251_, L_252_ = spawn(function()
CastRay(L_105_)
end)
for L_254_forvar1, L_255_forvar2 in pairs(L_59_:GetChildren()) do
if L_255_forvar2.Name:sub(1, 7) == "FlashFX" then
L_255_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_256_forvar1, L_257_forvar2 in pairs(L_59_:GetChildren()) do
if L_257_forvar2.Name:sub(1, 7) == "FlashFX" then
L_257_forvar2.Enabled = false
end
end
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true then
if L_106_ > 0 then
BoltingForwardAnim()
end
end
end)
end
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
wait(L_24_.Firerate)
L_76_ = true
BoltBackAnim()
BoltForwardAnim()
IdleAnim()
L_76_ = false
local L_253_ = JamCalculation()
if L_253_ then
L_69_ = false
else
L_69_ = true
end
Shooting = false
end
end
function fireAuto()
while not Shooting and L_106_ > 0 and L_68_ and L_69_ and L_15_ do
L_69_ = false
Recoiling = true
--CheckReverb()
if L_54_ then
L_54_:FireServer(L_59_:WaitForChild('Fire').SoundId, L_59_)
else
L_59_:WaitForChild('Fire'):Play()
end
L_112_:FireServer()
L_106_ = L_106_ - 1
UpdateAmmo()
Shooting = true
RecoilFront = true
L_105_ = CreateBullet(L_24_.BulletSpread)
local L_258_, L_259_ = spawn(function()
CastRay(L_105_)
end)
for L_261_forvar1, L_262_forvar2 in pairs(L_59_:GetChildren()) do
if L_262_forvar2.Name:sub(1, 7) == "FlashFX" then
L_262_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_263_forvar1, L_264_forvar2 in pairs(L_59_:GetChildren()) do
if L_264_forvar2.Name:sub(1, 7) == "FlashFX" then
L_264_forvar2.Enabled = false
end
end
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true then
if L_106_ > 0 then
BoltingForwardAnim()
end
end
end)
end
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
wait(L_24_.Firerate)
local L_260_ = JamCalculation()
if L_260_ then
L_69_ = false
else
L_69_ = true
end
Shooting = false
end
end
function fireBurst()
if not Shooting and L_106_ > 0 and L_68_ and L_15_ then
for L_265_forvar1 = 1, L_24_.BurstNum do
if L_106_ > 0 and L_68_ then
L_69_ = false
Recoiling = true
--CheckReverb()
if L_54_ then
L_54_:FireServer(L_59_:WaitForChild('Fire').SoundId, L_59_)
else
L_59_:WaitForChild('Fire'):Play()
end
L_112_:FireServer()
L_105_ = CreateBullet(L_24_.BulletSpread)
local L_266_, L_267_ = spawn(function()
CastRay(L_105_)
end)
for L_269_forvar1, L_270_forvar2 in pairs(L_59_:GetChildren()) do
if L_270_forvar2.Name:sub(1, 7) == "FlashFX" then
L_270_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_271_forvar1, L_272_forvar2 in pairs(L_59_:GetChildren()) do
if L_272_forvar2.Name:sub(1, 7) == "FlashFX" then
L_272_forvar2.Enabled = false
end
end
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true then
if L_106_ > 0 then
BoltingForwardAnim()
end
end
end)
end
L_106_ = L_106_ - 1
UpdateAmmo()
RecoilFront = true
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
wait(L_24_.Firerate)
local L_268_ = JamCalculation()
if L_268_ then
L_69_ = false
else
L_69_ = true
end
end
Shooting = true
end
Shooting = false
end
end
function Shoot()
if L_15_ and L_69_ then
if L_92_ == 1 then
fireSemi()
elseif L_92_ == 2 then
fireAuto()
elseif L_92_ == 3 then
fireBurst()
elseif L_92_ == 4 then
fireBoltAction()
elseif L_92_ == 5 then
fireShot()
elseif L_92_ == 6 then
fireExplo()
end
end
end
|
--== Init/config ==--
|
local car = script.Parent.Car.Value
local inputService = game:GetService("UserInputService")
local sts = script.Start
script:WaitForChild("Start")
local delayToStartEngine = 2.8 -- The script will wait this many seconds to turn the car on
local delayToStopStartupSound = 0.1 -- The script will wait this many seconds after starting the car before stopping your ignition sound
local primaryKey = Enum.KeyCode.LeftShift -- Which key on your keyboard will start your car?
local modifierKey = Enum.KeyCode.K -- I recommend using Right Shift - no conflicts with default AC6 keybinds, and most people never use it anyways
-- You could probably get away with Right Control as well
|
---Command types.
---Process a command as it is being typed. This allows for manipulation of the chat bar.
|
local IN_PROGRESS_MESSAGE_PROCESSOR = 0
|
--[=[
@tag Component Class
@return Promise<ComponentInstance>
Resolves a promise once the component instance is present on a given
Roblox instance.
An optional `timeout` can be provided to reject the promise if it
takes more than `timeout` seconds to resolve. If no timeout is
supplied, `timeout` defaults to 60 seconds.
```lua
local MyComponent = require(somewhere.MyComponent)
MyComponent:WaitForInstance(workspace.SomeInstance):andThen(function(myComponentInstance)
-- Do something with the component class
end)
```
]=]
|
function Component:WaitForInstance(instance: Instance, timeout: number?)
local componentInstance = self:FromInstance(instance)
if componentInstance then
return Promise.resolve(componentInstance)
end
return Promise.fromEvent(self.Started, function(c)
local match = c.Instance == instance
if match then
componentInstance = c
end
return match
end):andThen(function()
return componentInstance
end):timeout(if type(timeout) == "number" then timeout else DEFAULT_TIMEOUT)
end
|
--------------------
--| Script Logic |--
--------------------
|
SwooshSound:Play()
Rocket.Touched:connect(OnTouched)
|
--[[
Creates a new promise that receives the result of this promise.
The given callbacks are invoked depending on that result.
]]
|
function Promise.prototype:_andThen(traceback, successHandler, failureHandler)
self._unhandledRejection = false
-- Create a new promise to follow this part of the chain
return Promise._new(traceback, function(resolve, reject)
-- Our default callbacks just pass values onto the next promise.
-- This lets success and failure cascade correctly!
local successCallback = resolve
if successHandler then
successCallback = createAdvancer(
traceback,
successHandler,
resolve,
reject
)
end
local failureCallback = reject
if failureHandler then
failureCallback = createAdvancer(
traceback,
failureHandler,
resolve,
reject
)
end
if self._status == Promise.Status.Started then
-- If we haven't resolved yet, put ourselves into the queue
table.insert(self._queuedResolve, successCallback)
table.insert(self._queuedReject, failureCallback)
elseif self._status == Promise.Status.Resolved then
-- This promise has already resolved! Trigger success immediately.
successCallback(unpack(self._values, 1, self._valuesLength))
elseif self._status == Promise.Status.Rejected then
-- This promise died a terrible death! Trigger failure immediately.
failureCallback(unpack(self._values, 1, self._valuesLength))
elseif self._status == Promise.Status.Cancelled then
-- We don't want to call the success handler or the failure handler,
-- we just reject this promise outright.
reject(Error.new({
error = "Promise is cancelled",
kind = Error.Kind.AlreadyCancelled,
context = "Promise created at\n\n" .. traceback,
}))
end
end, self)
end
function Promise.prototype:andThen(successHandler, failureHandler)
assert(
successHandler == nil or type(successHandler) == "function" or successHandler.__call ~= nil,
string.format(ERROR_NON_FUNCTION, "Promise:andThen")
)
assert(
failureHandler == nil or type(failureHandler) == "function" or failureHandler.__call ~= nil,
string.format(ERROR_NON_FUNCTION, "Promise:andThen")
)
return self:_andThen(debug.traceback(nil, 2), successHandler, failureHandler)
end
|
--[[Weight and CG]]
|
Tune.Weight = 2500 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
--[[
Pops a node off of the navigation stack.
]]
|
function TestSession:popNode()
assert(#self.nodeStack > 0, "Tried to pop from an empty node stack!")
table.remove(self.nodeStack, #self.nodeStack)
table.remove(self.contextStack, #self.contextStack)
table.remove(self.expectationContextStack, #self.expectationContextStack)
end
|
--Initialize Chassis
|
local ScriptsFolder = Car:FindFirstChild("Scripts")
local Chassis = require(ScriptsFolder:WaitForChild("Chassis"))
Chassis.InitializeDrivingValues()
Chassis.Reset()
|
-- Connection class
|
local Connection = {}
Connection.__index = Connection
function Connection.new(signal, fn)
return setmetatable({
_connected = true,
_signal = signal,
_fn = fn,
_next = false,
}, Connection)
end
function Connection:Disconnect()
self._connected = false
-- Unhook the node, but DON'T clear it. That way any fire calls that are
-- currently sitting on this node will be able to iterate forwards off of
-- it, but any subsequent fire calls will not hit it, and it will be GCed
-- when no more fire calls are sitting on it.
if self._signal._handlerListHead == self then
self._signal._handlerListHead = self._next
else
local prev = self._signal._handlerListHead
while prev and prev._next ~= self do
prev = prev._next
end
if prev then
prev._next = self._next
end
end
end
|
--[[**
asserts a given check
@param check The function to wrap with an assert
@returns A function that simply wraps the given check in an assert
**--]]
|
function t.strict(check)
return function(...)
assert(check(...))
end
end
do
local checkChildren = t.map(t.string, t.callback)
|
--- Enables the "Mash to open" feature
|
function Cmdr:SetMashToEnable(isEnabled)
self.MashToEnable = isEnabled
if isEnabled then
self:SetEnabled(false)
end
end
|
--[[
Manual Ignition Tool Roblox_MELIHCAN10
--]]
|
wait(0.2) -- Removing this wait could break the script. Please do not touch this.
|
------------------------------------------------------------------------
--
-- * used in multiple locations
------------------------------------------------------------------------
|
function luaK:dischargevars(fs, e)
local k = e.k
if k == "VLOCAL" then
e.k = "VNONRELOC"
elseif k == "VUPVAL" then
e.info = self:codeABC(fs, "OP_GETUPVAL", 0, e.info, 0)
e.k = "VRELOCABLE"
elseif k == "VGLOBAL" then
e.info = self:codeABx(fs, "OP_GETGLOBAL", 0, e.info)
e.k = "VRELOCABLE"
elseif k == "VINDEXED" then
self:freereg(fs, e.aux)
self:freereg(fs, e.info)
e.info = self:codeABC(fs, "OP_GETTABLE", 0, e.info, e.aux)
e.k = "VRELOCABLE"
elseif k == "VVARARG" or k == "VCALL" then
self:setoneret(fs, e)
else
-- there is one value available (somewhere)
end
end
|
--health.Changed:connect(function()
--root.Velocity = Vector3.new(0,5000,0)
--end)
|
local anims = {}
local lastAttack= tick()
local target,targetType
local lastLock = tick()
local fleshDamage = 25
local structureDamage = 20
local path = nil
for _,animObject in next,animations do
anims[animObject.Name] = hum:LoadAnimation(animObject)
end
function Attack(thing,dmg)
if tick()-lastAttack > 2 then
hum:MoveTo(root.Position)
lastAttack = tick()
anims.AntWalk:Stop()
anims.AntMelee:Play()
if thing.ClassName == "Player" then
root.FleshHit:Play()
ant:SetPrimaryPartCFrame(CFrame.new(root.Position,Vector3.new(target.Character.PrimaryPart.Position.X,root.Position.Y,target.Character.PrimaryPart.Position.Z)))
elseif thing.ClassName == "Model" then
root.StructureHit:Play()
end
rep.Events.NPCAttack:Fire(thing,dmg)
end
end
function Move(point)
hum:MoveTo(point)
if not anims.AntWalk.IsPlaying then
anims.AntWalk:Play()
end
end
function ScanForPoint()
local newPoint
local rayDir = Vector3.new(math.random(-100,100)/100,0,math.random(-100,100)/100)
local ray = Ray.new(root.Position,rayDir*math.random(10,50),ant)
local part,pos = workspace:FindPartOnRay(ray)
Move(pos)
enRoute = true
end
|
--[[
Create a new TestPlan from a list of specification functions.
These functions should call a combination of `describe` and `it` (and their
variants), which will be turned into a test plan to be executed.
Parameters:
- modulesList - list of tables describing test modules {
method, -- specification function described above
path, -- array of parent entires, first element is the leaf that owns `method`
pathStringForSorting -- a string representation of `path`, used for sorting of the test plan
}
- testNamePattern - Only tests matching this Lua pattern string will run. Pass empty or nil to run all tests
- extraEnvironment - Lua table holding additional functions and variables to be injected into the specification
function during execution
]]
|
function TestPlanner.createPlan(modulesList, testNamePattern, extraEnvironment)
local plan = TestPlan.new(testNamePattern, extraEnvironment)
table.sort(modulesList, function(a, b)
return a.pathStringForSorting < b.pathStringForSorting
end)
for _, module in ipairs(modulesList) do
plan:addRoot(module.path, module.method)
end
return plan
end
return TestPlanner
|
-- -- -- -- -- -- --
--DIRECTION SCROLL--
-- -- -- -- -- -- --
|
This.Parent.Parent.Parent.Parent.Parent:WaitForChild("Direction").Changed:connect(function(val)
if val == 1 then
SetDisplay(1,"U0")
elseif val == -1 then
SetDisplay(1,"D0")
else
SetDisplay(1,"NIL")
end
end)
|
--
|
FakeTorso.Size = Torso.Size
FakeHumanoidRootPart.Size = HumanoidRootPart.Size
FakeTorso.CFrame = FakeHumanoidRootPart.CFrame
RootHipClone = RootHipJoint:Clone()
RootHipClone.Parent = FakeHumanoidRootPart
RootHipClone.Part0 = FakeHumanoidRootPart
RootHipClone.Part1 = FakeTorso
|
-- Reparents an instance and outputs helpful logging information so we can see
-- where instances are going at runtime.
|
local function move(instance: Instance, newParent: Instance)
instance.Parent = newParent
log("move", ("%s -> %s"):format(instance.Name, instance:GetFullName()))
end
|
-- << VARIABLES >>
|
local topBar = main.gui.CustomTopBar
local coreToHide = {"Chat", "PlayerList"}
local originalCoreStates = {};
local cmdBar = main.gui.CmdBar
local currentProps = {}
local originalTopBarTransparency = 0.5
local originalTopBarVisibility = true
local mainProps
mainProps = {
maxSuggestions = 5;
mainParent = cmdBar;
textBox = cmdBar.SearchFrame.TextBox;
rframe = cmdBar.ResultsFrame;
suggestionPos = 1;
suggestionDisplayed = 0;
forceExecute = false;
highlightColor = Color3.fromRGB(50,50,50);
otherColor = Color3.fromRGB(80,80,80);
suggestionLabels = {};
currentBarCommand = nil;
}
|
--[[Engine]]
|
local fFD = _Tune.FinalDrive*_Tune.FDMult
local fFDr = fFD*30/math.pi
local cGrav = workspace.Gravity*_Tune.InclineComp/32.2
local wDRatio = wDia*math.pi/60
local cfWRot = CFrame.Angles(math.pi/2,-math.pi/2,0)
local cfYRot = CFrame.Angles(0,math.pi,0)
local rtTwo = (2^.5)/2
if _Tune.Aspiration == "Single" then
_TCount = 1
_TPsi = _Tune.Boost
elseif _Tune.Aspiration == "Double" then
_TCount = 2
_TPsi = _Tune.Boost*2
end
--Horsepower Curve
local HP=_Tune.Horsepower/100
local HP_B=((_Tune.Horsepower*((_TPsi)*(_Tune.CompressRatio/10))/7.5)/2)/100
local Peak=_Tune.PeakRPM/1000
local Sharpness=_Tune.PeakSharpness
local CurveMult=_Tune.CurveMult
local EQ=_Tune.EqPoint/1000
--Horsepower Curve
function curveHP(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP/(Peak^2),CurveMult^(Peak/HP))+HP)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurveHP = curveHP(_Tune.PeakRPM)
function curvePSI(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP_B/(Peak^2),CurveMult^(Peak/HP_B))+HP_B)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurvePSI = curvePSI(_Tune.PeakRPM)
--Plot Current Horsepower
function GetCurve(x,gear)
local hp=(math.max(curveHP(x)/(PeakCurveHP/HP),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD*hpScaling)*1000
end
--Plot Current Boost (addition to Horsepower)
function GetPsiCurve(x,gear)
local hp=(math.max(curvePSI(x)/(PeakCurvePSI/HP_B),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD*hpScaling)*1000
end
--Output Cache
local HPCache = {}
local PSICache = {}
if _Tune.CurveCache then
for gear,ratio in pairs(_Tune.Ratios) do
local nhpPlot = {}
local bhpPlot = {}
for rpm = math.floor(_Tune.IdleRPM/_Tune.CacheInc),math.ceil((_Tune.Redline+100)/_Tune.CacheInc) do
local ntqPlot = {}
local btqPlot = {}
ntqPlot.Horsepower,ntqPlot.Torque = GetCurve(rpm*_Tune.CacheInc,gear-2)
btqPlot.Horsepower,btqPlot.Torque = GetPsiCurve(rpm*_Tune.CacheInc,gear-2)
hp1,tq1 = GetCurve((rpm+1)*_Tune.CacheInc,gear-2)
hp2,tq2 = GetPsiCurve((rpm+1)*_Tune.CacheInc,gear-2)
ntqPlot.HpSlope = (hp1 - ntqPlot.Horsepower)
btqPlot.HpSlope = (hp2 - btqPlot.Horsepower)
ntqPlot.TqSlope = (tq1 - ntqPlot.Torque)
btqPlot.TqSlope = (tq2 - btqPlot.Torque)
nhpPlot[rpm] = ntqPlot
bhpPlot[rpm] = btqPlot
end
table.insert(HPCache,nhpPlot)
table.insert(PSICache,bhpPlot)
end
end
if _Tune.CurveCache then
for gear,ratio in pairs(_Tune.Ratios) do
for rpm = math.floor(_Tune.IdleRPM/_Tune.CacheInc),math.ceil((_Tune.Redline+100)/_Tune.CacheInc) do
end
end
end
--Powertrain
wait()
--Update RPM
function RPM()
--Neutral Gear
if _CGear==0 then _ClutchOn = false end
--Car Is Off
local revMin = _Tune.IdleRPM
if not _IsOn then
revMin = 0
_CGear = 0
_ClutchOn = false
_GThrot = _Tune.IdleThrottle/100
end
--Determine RPM
local maxSpin=0
for i,v in pairs(Drive) do
if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end
end
if _ClutchOn then
local aRPM = math.max(math.min(maxSpin*_Tune.Ratios[_CGear+2]*fFDr,_Tune.Redline+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.87)
_RPM = _RPM*clutchP + aRPM*(1-clutchP)
else
if _GThrot-(_Tune.IdleThrottle/100)>0 then
if _RPM>_Tune.Redline then
_RPM = _RPM-_Tune.RevBounce*2
else
_RPM = math.min(_RPM+_Tune.RevAccel*_GThrot,_Tune.Redline+100)
end
else
_RPM = math.max(_RPM-_Tune.RevDecay,revMin)
end
end
--Rev Limiter
_spLimit = (_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+2])
if _RPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_RPM = _RPM-_Tune.RevBounce
else
_RPM = _RPM-_Tune.RevBounce*.5
end
end
local TPsi = _TPsi/_TCount
if _CGear==0 then
_Boost = _Boost + ((((((_RPM*(_GThrot*_GThrotShift*1.2)/_Tune.Redline)/8.5)-(((_Boost/TPsi*(TPsi/15)))))*((36/_Tune.TurboSize)*2))/TPsi)*15)
else
_Boost = _Boost + ((((((_HP*(_GThrot*_GThrotShift*1.2)/_Tune.Horsepower)/8)-(((_Boost/TPsi*(TPsi/15)))))*((36/_Tune.TurboSize)*2))/TPsi)*15)
end
if _Boost < 0.05 then _Boost = 0.05 elseif _Boost > 2 then _Boost = 2 end
end
--Automatic Transmission
function Auto()
local maxSpin=0
for i,v in pairs(Drive) do if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end end
if _IsOn then
_ClutchOn = true
if _CGear >= 1 then
if _CGear==1 and _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 5 then
_CGear = 1
else
if _Tune.AutoShiftMode == "RPM" then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
if (_CGear ~= 0) and (_CGear ~= #_Tune.Ratios-2) then
end
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) then
if _CGear ~= 1 then
end
_CGear=math.max(_CGear-1,1)
end
else
if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then
if (_CGear ~= 0) and (_CGear ~= #_Tune.Ratios-2) then
end
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) then
if _CGear ~= 1 then
end
_CGear=math.max(_CGear-1,1)
end
end
end
end
end
end
local tqTCS = 1
--Apply Power
function Engine()
if _ClutchOn then
if _Tune.CurveCache then
local cTq = HPCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/_Tune.CacheInc)]
_NH = cTq.Horsepower+(cTq.HpSlope*((_RPM-math.floor(_RPM/_Tune.CacheInc))/1000)%1)
_NT = cTq.Torque+(cTq.TqSlope*((_RPM-math.floor(_RPM/_Tune.CacheInc))/1000)%1)
else
_NH,_NT = GetCurve(_RPM,_CGear)
end
if _Tune.Aspiration ~= "Natural" then
if _Tune.CurveCache then
local bTq = PSICache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/_Tune.CacheInc)]
_BH = bTq.Horsepower+(bTq.HpSlope*((_RPM-math.floor(_RPM/_Tune.CacheInc))/1000)%1)
_BT = bTq.Torque+(bTq.TqSlope*((_RPM-math.floor(_RPM/_Tune.CacheInc))/1000)%1)
else
_BH,_BT = GetPsiCurve(_RPM,_CGear)
end
_HP = _NH + (_BH*(_Boost/2))
_OutTorque = _NT + (_BT*(_Boost/2))
else
_HP = _NH
_OutTorque = _NT
end
local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav
if _CGear==-1 then iComp=-iComp end
_OutTorque = _OutTorque*math.max(1,(1+iComp))
else
_HP,_NH,_BH,_OutTorque,_NT,_BT = 0,0,0,0,0,0
end
local TPsi = _TPsi/_TCount
if _Boost < 0.05 then _Boost = 0.05 elseif _Boost > 2 then _Boost = 2 end
--Average Rotational Speed Calculation
local fwspeed=0
local fwcount=0
local rwspeed=0
local rwcount=0
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then
fwspeed=fwspeed+v.RotVelocity.Magnitude
fwcount=fwcount+1
elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then
rwspeed=rwspeed+v.RotVelocity.Magnitude
rwcount=rwcount+1
end
end
fwspeed=fwspeed/fwcount
rwspeed=rwspeed/rwcount
local cwspeed=(fwspeed+rwspeed)/2
--Update Wheels
for i,v in pairs(car.Wheels:GetChildren()) do
--Reference Wheel Orientation
local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector
local aRef=1
local diffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--AWD Torque Scaling
if _Tune.Config == "AWD" then _OutTorque = _OutTorque*rtTwo end
--Differential/Torque-Vectoring
if v.Name=="FL" or v.Name=="FR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
elseif v.Name=="RL" or v.Name=="RR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
end
_TCSActive = false
_ABSActive = false
--Output
if _PBrake and ((_Tune.Config ~= "FWD" and (((v.Name=="FL" or v.Name=="FR") and car.DriveSeat.Velocity.Magnitude<20) or ((v.Name=="RR" or v.Name=="RL") and car.DriveSeat.Velocity.Magnitude>=20))) or (_Tune.Config == "FWD" and (v.Name=="RR" or v.Name=="RL"))) then
--PBrake
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*PBrakeForce
v["#AV"].angularvelocity=Vector3.new()
else
--Apply Power
if ((_TMode == "Manual" or _TMode == "Semi" or _TMode == "Auto") and _GBrake==0)then
local driven = false
for _,a in pairs(Drive) do if a==v then driven = true end end
if driven then
local on=1
if not script.Parent.IsOn.Value then on=0 end
local throt = _GThrot * _GThrotShift
--Apply TCS
if _TCS then
tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100)))
end
if tqTCS < 1 then
_TCSAmt = tqTCS
_TCSActive = true
end
--Update Forces
local dir = 1
if _CGear==-1 then dir = -1 end
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_OutTorque*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on
v["#AV"].angularvelocity=Ref*aRef*_spLimit*dir
else
v["#AV"].maxTorque=Vector3.new()
v["#AV"].angularvelocity=Vector3.new()
end
--Brakes
else
local brake = _GBrake
--Apply ABS
local tqABS = 1
if _ABS and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
tqABS = 0
end
if tqABS < 1 then
_ABSActive = true
end
--Update Forces
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*FBrakeForce*brake*tqABS
else
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*RBrakeForce*brake*tqABS
end
v["#AV"].angularvelocity=Vector3.new()
end
end
end
end
|
--Set up equipping and unequipping the tool.
|
Tool.Equipped:Connect(function()
if not Equipped then
Equipped = true
CurrentCharacter = Tool.Parent
CurrentPlayer = game.Players:GetPlayerFromCharacter(CurrentCharacter)
EquipSound:Play()
--Create the left hand rocket.
local LeftGripAttachment = CurrentCharacter:FindFirstChild("LeftGripAttachment",true)
if LeftGripAttachment then
CurrentHandRocket = RocketCreator:CreateRocket(false)
CurrentHandRocket.Name = "HandRocket"
CurrentHandRocket.Transparency = 1
CurrentHandRocket.Parent = Tool
local Weld = Instance.new("Weld")
Weld.Part0 = LeftGripAttachment.Parent
Weld.Part1 = CurrentHandRocket
Weld.C0 = LeftGripAttachment.CFrame
Weld.C1 = CFrame.Angles(0,math.pi,0)
Weld.Parent = CurrentHandRocket
end
RocketBuffer:SetCurrentPlayer(CurrentPlayer)
end
end)
Tool.Unequipped:Connect(function()
if Equipped then
Equipped = false
CurrentCharacter = nil
CurrentPlayer = nil
EquipSound:Stop()
if CurrentHandRocket then CurrentHandRocket:Destroy() end
RocketBuffer:SetCurrentPlayer()
end
end)
|
--[[**
ensures Lua primitive table type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.table = primitive("table")
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Khaki",Paint)
end)
|
-- script.Parent.Menu.Visible=false
|
else
-- старый
script.Parent.History.Visible=false
|
-- check for config values
|
local config = script:FindFirstChild(name)
if (config ~= nil) then
|
-- http://www.ryanjuckett.com/programming/damped-springs/
|
local EPSILON = 0.0001;
local exp = math.exp;
local cos = math.cos;
local sin = math.sin;
local sqrt = math.sqrt;
local spring = {};
local spring_mt = {__index = spring};
function spring.new(p0, v0, target, angularFrequency, dampingRatio)
local self = {};
self.p = p0;
self.v = v0;
self.target = target;
self.angularFrequency = angularFrequency or 10;
self.dampingRatio = dampingRatio or 1;
return setmetatable(self, spring_mt);
end
function spring:update(dt)
local aF = self.angularFrequency;
local dR = self.dampingRatio;
if (aF < EPSILON) then return; end;
if (dR < 0) then dR = 0; end;
local epos = self.target;
local dpos = self.p - epos;
local dvel = self.v;
if (dR > 1 + EPSILON) then
local za = -aF * dR;
local zb = aF * sqrt(dR*dR - 1);
local z1 = za - zb;
local z2 = za + zb;
local expTerm1 = exp(z1 * dt);
local expTerm2 = exp(z2 * dt);
local c1 = (dvel - dpos*z2)/(-2*zb);
local c2 = dpos - c1;
self.p = epos + c1*expTerm1 + c2*expTerm2;
self.v = c1*z1*expTerm1 + c2*z2*expTerm2;
elseif (dR > 1 - EPSILON) then
local expTerm = exp(-aF * dt);
local c1 = dvel + aF*dpos;
local c2 = dpos;
local c3 = (c1*dt + c2)*expTerm;
self.p = epos + c3;
self.v = (c1*expTerm) - (c3*aF);
else
local omegaZeta = aF*dR;
local alpha = aF*sqrt(1 - dR*dR);
local expTerm = exp(-omegaZeta*dt);
local cosTerm = cos(alpha*dt);
local sinTerm = sin(alpha*dt);
local c1 = dpos;
local c2 = (dvel + omegaZeta*dpos) / alpha;
self.p = epos + expTerm*(c1*cosTerm + c2*sinTerm);
self.v = -expTerm*((c1*omegaZeta - c2*alpha)*cosTerm + (c1*alpha + c2*omegaZeta)*sinTerm);
end
end
return spring;
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
-- STATE CHANGE HANDLERS
|
function onRunning(speed)
local heightScale = if userAnimateScaleRun then getHeightScale() else 1
local movedDuringEmote = currentlyPlayingEmote and Humanoid.MoveDirection == Vector3.new(0, 0, 0)
local speedThreshold = movedDuringEmote and (Humanoid.WalkSpeed / heightScale) or 0.75
if speed > speedThreshold * heightScale then
local scale = 16.0
playAnimation("walk", 0.2, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Running"
else
if emoteNames[currentAnim] == nil and not currentlyPlayingEmote then
playAnimation("idle", 0.2, Humanoid)
pose = "Standing"
end
end
end
function onDied()
pose = "Dead"
end
function onJumping()
playAnimation("jump", 0.1, Humanoid)
jumpAnimTime = jumpAnimDuration
pose = "Jumping"
end
function onClimbing(speed)
if userAnimateScaleRun then
speed /= getHeightScale()
end
local scale = 5.0
playAnimation("climb", 0.1, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
if (jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
end
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
|
--[[
Add a new child under the test plan's root node.
]]
|
function TestPlan:addChild(phrase, nodeType, nodeModifier)
nodeModifier = getModifier(phrase, self.testNamePattern, nodeModifier)
local child = TestNode.new(self, phrase, nodeType, nodeModifier)
table.insert(self.children, child)
return child
end
|
--[[
Returns a HumanoidDescription representing the outfit that "player" is
currently wearing, with the addition of one extra item given by "assetId".
The "assetType" parameter represents which kind of accessories the new one
belongs to. It must be the name of a property under HumanoidDescription. If
the user is already wearing items of that type, those are removed first.
In case of a failure to retrieve "player"'s current outfit, a generic
character look is generated.
]]
|
local MerchBooth = script:FindFirstAncestor("MerchBooth")
local Cryo = require(MerchBooth.Packages.Cryo)
local matchAssetTypeToAccessoryType = require(MerchBooth.Modules.matchAssetTypeToAccessoryType)
local isAccessory = require(MerchBooth.Modules.isAccessory)
local isClassicClothing = require(MerchBooth.Modules.isClassicClothing)
local DEFAULT_BODY_COLOR = Color3.fromRGB(122, 122, 122)
local function generateDescriptionWithItem(player: Player, assetId: number, assetType: Enum.AssetType)
local character = player and player.Character
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
local description = humanoid and humanoid:GetAppliedDescription()
-- We could run into the "no description" case if, for instance, the game
-- has characters disabled. In which case, we want a new description with
-- character colors set to grey (default is black and isn't very visible in
-- the default dark theme).
if not description then
description = Instance.new("HumanoidDescription")
description.HeadColor = DEFAULT_BODY_COLOR
description.TorsoColor = DEFAULT_BODY_COLOR
description.LeftArmColor = DEFAULT_BODY_COLOR
description.RightArmColor = DEFAULT_BODY_COLOR
description.LeftLegColor = DEFAULT_BODY_COLOR
description.RightLegColor = DEFAULT_BODY_COLOR
end
if isAccessory(assetType) then
local accessoryTypeEnum = matchAssetTypeToAccessoryType(assetType)
local accessories = Cryo.List.filter(description:GetAccessories(true), function(accessory)
return accessory.AccessoryType ~= accessoryTypeEnum
end)
table.insert(accessories, {
Order = 1,
AssetId = assetId,
AccessoryType = accessoryTypeEnum,
})
description:SetAccessories(accessories, true)
elseif isClassicClothing(assetType) then
if assetType == Enum.AssetType.TShirt then
description.GraphicTShirt = assetId
elseif assetType == Enum.AssetType.Shirt then
description.Shirt = assetId
elseif assetType == Enum.AssetType.Pants then
description.Pants = assetId
end
end
return description
end
return generateDescriptionWithItem
|
--[[Rear]]
|
--
Tune.RSusDamping = 120 -- Dampening
Tune.RSusStiffness = 4000 -- Stiffness
Tune.RSusLength = 1.85 -- Suspension length (in studs)
Tune.RPreComp = -0.1 -- Vehicle height, relative to your suspension settings
Tune.RExtLimit = .2 -- Max Extension Travel (in studs)
Tune.RCompLimit = .8 -- Max Compression Travel (in studs)
Tune.RBaseOffset = { -- Suspension base point
--[[Lateral]] 0 , -- positive = outward
--[[Vertical]] 1.7 , -- positive = upward
--[[Forward]] -.5 } -- positive = forward
Tune.RBricksVisible = false -- Makes the front suspension bricks visible (Debug)
Tune.RConstsVisible = false -- Makes the front suspension constraints visible (Debug)
|
--!strict
|
local BloxbizSDK = script.Parent.Parent.Parent.Parent
local UtilsStorage = BloxbizSDK:FindFirstChild("Utils")
local Fusion = require(UtilsStorage:WaitForChild("Fusion"))
export type States = {
Enabled: Fusion.Value<boolean>,
Hovering: Fusion.Value<boolean>,
HeldDown: Fusion.Value<boolean>,
Selected: Fusion.Value<boolean>,
}
export type Values<T> = {
MouseDown: T?,
Selected: T?,
Hover: T?,
Disabled: T?,
Default: T,
}
return function(states: States, values: Values<any>, speed: number?, damping: number?): Fusion.Spring<any>
return Fusion.Spring(
Fusion.Computed(function()
if states.Enabled:get() then
if states.Selected:get() then
return values.Selected or values.Default
elseif states.HeldDown:get() then
return values.MouseDown or values.Default
elseif states.Hovering:get() then
return values.Hover or values.Default
else
return values.Default
end
else
return values.Disabled or values.Default
end
end),
speed or 20,
damping or 1
)
end
|
-- NOTE: To hide this from the games folder structure use the command bar and type >hide
-- To Show it again type >show
|
local SETTINGS = {
--The thing you need to use before typing the macro
PREFIX = "!",
--The splitter character for between the (). Note: This has to be 1 character
ARGUMENT_SPLITTER = ",",
--The default is tab, and this is the key you must press after typing out the macro
ACTIVATION_KEY = " ",
--Used for >MS(). If this is on and it requires a service to be added to the file it will also add that chunk of code. (Note: With this off it wont work as intended if it doesnt have the service already in file declared as a varable)
AUTO_IMPORT = true,
--turn this off to allow any sort of casing like: >gS(Players),
CASE_SENSATIVE_COMMANDS = false,
--Used for >MS() so it knows what paths its allowed to look into (Note: this has to be a top level path)
SEARCH_LOCATIONS = {"Workspace", "Players", "MaterialService", "ReplicatedFirst", "ReplicatedStorage", "ServerScriptService", "ServerStorage", "StarterGui", "StarterPack", "StarterPlayer", "Teams", "Chat", "TextChatService", "LocalizationService", "TestService"},
--NOT WORKING RIGHT, ONLY TURN ON IF YOU WANT TO SEE WHAT IT DOES.
--What its supposed to do is if it sees that a required service is lower than the line you are adding it to then it will move the service up to the current line
REORGANISE_IMPORTS = false,
}
return SETTINGS
|
--------------------------------------------------------------------
|
if smoke == true then
mouse.KeyDown:connect(function(key)
if key == camkey and enabled == false then
local children = car.Wheels:GetChildren()
for index, child in pairs(children) do
if child:IsA("Part") then
local effect = script.soundeffect:Clone()
effect.Name = "soundeffectCop"
effect.Parent = child.SQ
end
end
elseif key == camkey and enabled == true then
local children = car.Wheels:GetChildren()
for index, child in pairs(children) do
if child:IsA("Part") then
child.SQ.soundeffectCop:Destroy()
end
end
end
car.DriveSeat.ChildRemoved:Connect(function(child)
if child.Name == "SeatWeld" then
local children = car.Wheels:GetChildren()
for index, child in pairs(children) do
if child:IsA("Part") then
child.SQ.soundeffectCop:Destroy()
end
end
end
end)
end)
end
|
--[=[
Gets the service by name. Throws an error if the service is not found.
]=]
|
function KnitServer.GetService(serviceName: string): Service
assert(started, "Cannot call GetService until Knit has been started")
assert(type(serviceName) == "string", `ServiceName must be a string; got {type(serviceName)}`)
return assert(services[serviceName], `Could not find service "{serviceName}"`) :: Service
end
|
--[=[
Creates a new controller.
:::caution
Controllers must be created _before_ calling `Knit.Start()`.
:::
```lua
-- Create a controller
local MyController = Knit.CreateController {
Name = "MyController",
}
function MyController:KnitStart()
print("MyController started")
end
function MyController:KnitInit()
print("MyController initialized")
end
```
]=]
|
function KnitClient.CreateController(controllerDef: ControllerDef): Controller
assert(type(controllerDef) == "table", "Controller must be a table; got " .. type(controllerDef))
assert(type(controllerDef.Name) == "string", "Controller.Name must be a string; got " .. type(controllerDef.Name))
assert(#controllerDef.Name > 0, "Controller.Name must be a non-empty string")
assert(not DoesControllerExist(controllerDef.Name), "Controller \"" .. controllerDef.Name .. "\" already exists")
local controller = controllerDef :: Controller
controllers[controller.Name] = controller
return controller
end
|
-- NOTE, on the first, and last numbers, the ones that make your hat go left/right/ahead/back shouldn't be changed by whole numbers
-- to make your hat giver perfect, if you have to use those two numbers, move it slowly by ".1's"
-- This can also go for the middle number. If your hat is slightly higher than its supposed to be, than edit the number slightly.
-- Do not change the numbers by whole numbers, or else it will go really far off. Change the numbers by ".1's" and ".2's"
| |
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local throt=0
local redline=0
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
throt = math.max(.3,throt-.2)
else
throt = math.min(1,throt+.1)
end
if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
redline=.5
else
redline=1
end
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
local Pitch = math.max((((script.SetPitch.Value + script.SetRev.Value*_RPM/_Tune.Redline))*on^2),script.SetPitch.Value)
if FE then
handler:FireServer("updateSound",Pitch)
else
car.DriveSeat.Rev.Pitch = Pitch
end
end
|
-- Services
|
local ContextActionService = game:GetService 'ContextActionService'
local Workspace = game:GetService 'Workspace'
|
--[=[
Returns true is the brio is dead.
```lua
local brio = Brio.new("a", "b")
print(brio:IsDead()) --> false
brio:Kill()
print(brio:IsDead()) --> true
```
@return boolean
]=]
|
function Brio:IsDead()
return self._values == nil
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.Egg
|
-- Footsteps
|
local stepEvent = Evt.Step
stepEvent.OnServerEvent:Connect(function(player,soundId,volume,timeStamp)
stepEvent:FireAllClients(player,soundId,volume,timeStamp)
end)
|
--[=[
Takes a result and converts it to a brio if it is not one.
@return (source: Observable<Brio<T> | T>) -> Observable<Brio<T>>
]=]
|
function RxBrioUtils.toBrio()
return Rx.map(function(result)
if Brio.isBrio(result) then
return result
end
return Brio.new(result)
end)
end
|
-- This is not ideal in a server script.
-- CFraming should be done on the client for a less choppy experience.
|
local base = script.Parent:WaitForChild('Base')
local startCF = base.CFrame
local startTime = os.clock()
local tau = math.pi*2
local VERTICAL_SWING_AMOUNT = 90
local VERTICAL_SWING_TIME = 19
local HORIZONTAL_SWING_AMOUNT = 0
local HORIZONTAL_SWING_TIME = 6
while base and base.Parent do
wait()
local d = os.clock() - startTime
base.CFrame = startCF * CFrame.Angles(0, math.sin(d*tau/HORIZONTAL_SWING_TIME)*math.rad(HORIZONTAL_SWING_AMOUNT)*.5, math.sin(d*tau/VERTICAL_SWING_TIME)*math.rad(VERTICAL_SWING_AMOUNT)*.5)
end
|
-- print("Keyframe : ".. frameName)
|
playToolAnimation(toolAnimName, 0.0, Humanoid)
end
end
function playToolAnimation(animName, transitionTime, humanoid, priority)
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while (roll > animTable[animName][idx].weight) do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end
|
---- if EntityData.All[newAnimal.Name].dangerZoneDamage then
---- saddledCritters[newAnimal].lastAttack = Rep.Constants.RelativeTime.Value
---- newAnimal:WaitForChild("DangerZone").Touched:connect(function(hit)
---- if (Rep.Constants.RelativeTime.Value - saddledCritters[newAnimal].lastAttack) >= EntityData.All[newAnimal.Name].dangerZoneSpeed then
---- local munched
----
---- if hit.Parent:FindFirstChild("Health") and (not hit:IsDescendantOf(newAnimal.DangerZone.Parent)) and EntityData.All[hit.Parent.Name] and EntityData.All[hit.Parent.Name].health then
------hit.Parent.Health.Value = hit.Parent.Health.Value - EntityData.All[newAnimal.Name].dangerZoneDamage
---- munched = true
----
---- local canDamage = false
---- for damageType, damageAmount in next, EntityData.All[newAnimal.Name].damages do
---- if EntityData.All[hit.Parent.Name].susceptions[damageType] then
---- canDamage = damageAmount
---- end
---- end
----
---- if canDamage then
---- DamageResource(hit.Parent, canDamage, player)
---- end
----
---- elseif hit.Parent:FindFirstChild("Humanoid") then
---- local otherPlayer = game.Players:GetPlayerFromCharacter(hit.Parent)
---- if otherPlayer and not AreAllies(saddledCritters[newAnimal].owner, otherPlayer) then
------ do damage to the player
---- munched = true
---- DamagePlayer(otherPlayer, CalculateToolDamageToPlayers(newAnimal.Name, otherPlayer))
----
---- end
---- end
----
------ if an attack went through
---- if munched then
---- saddledCritters[newAnimal].lastAttack = Rep.Constants.RelativeTime.Value
---- PlaySoundInObject(Rep.Sounds.Bank:FindFirstChild(EntityData.All[newAnimal.name].damageSound), newAnimal.Head)
---- local emitter = game.ReplicatedStorage.Particles.Teeth:Clone()
---- emitter.Parent = newAnimal.Head
---- emitter.EmissionDirection = Enum.NormalId.Top
---- wait()
---- emitter:Emit(1)
---- end
----
---- end
----
---- end)
---- end
| |
--// Player Events
|
game:GetService("RunService").RenderStepped:connect(function()
for L_32_forvar1, L_33_forvar2 in pairs(game.Players:GetChildren()) do
if L_33_forvar2:IsA('Player') and L_33_forvar2.TeamColor ~= L_1_.TeamColor and L_33_forvar2 ~= L_1_ and L_33_forvar2.Character and L_13_ then
if L_33_forvar2.Character.Head:FindFirstChild('TeamTag') then
L_33_forvar2.Character.Head.TeamTag:Destroy()
end
end
for L_18_forvar1, L_19_forvar2 in pairs(game.Players:GetChildren()) do
if L_19_forvar2:IsA('Player') and L_19_forvar2.Character and L_19_forvar2.Character.Head then
if L_19_forvar2.TeamColor == L_1_.TeamColor then
if L_19_forvar2.Character.Saude.FireTeam.SquadName.Value ~= '' then
spawnTag(L_19_forvar2.Character, L_19_forvar2.Character.Saude.FireTeam.SquadColor.Value)
else
spawnTag(L_19_forvar2.Character, Color3.fromRGB(255,255,255))
end
end;
end;
end
end
end)
|
-- Local player
|
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local humanoid = character:WaitForChild("Humanoid")
|
--------RIGHT DOOR --------
|
game.Workspace.doorright.l32.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
-- Model Position Tweening --
|
function Functions.CreateModelTween(Model, TweenInformation, Goal)
local CFrameValue = Instance.new("CFrameValue")
CFrameValue.Value = Model.PrimaryPart.CFrame
CFrameValue.Changed:Connect(function(Value)
Model:SetPrimaryPartCFrame(Value)
end)
local Tween = TweenService:Create(CFrameValue, TweenInformation, Goal)
Tween:Play()
Tween.Completed:Wait()
end
|
--[[Transmission]]
|
Tune.TransModes = {"Auto"} --[[
[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 = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 1.6 -- [TRANSMISSION CALCULATIONS FOR NERDS]
Tune.Ratios = { -- SPEED [SPS] = (Wheel diameter(studs) * pi(3.14) * RPM) / (60 * Gear Ratio * Final Drive * Multiplier)
--[[Reverse]] 3.40 ,-- WHEEL TORQUE = Engine Torque * Gear Ratio * Final Drive * Multiplier
--[[Neutral]] 0 ,
--[[ 1 ]] 3.77 ,
--[[ 2 ]] 2.34 ,
--[[ 3 ]] 1.52 ,
--[[ 4 ]] 1.14 ,
--[[ 5 ]] 0.86 ,
--[[ 6 ]] 0.69 ,
}
Tune.FDMult = 5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--End of Editable Values
|
local car = script.Parent.Car.Value
local hb = game:GetService('RunService').Heartbeat
local sound = car.Body.Drag.Wind
local sound2 = car.Body.Drag.Body
sound:Play()
sound2:Play()
local function update()
sound.Volume=Vol*(car.DriveSeat.Velocity.Magnitude/500)
sound2.Volume=Vol*(car.DriveSeat.Velocity.Magnitude/500)
car.Body.DownforceF.T.Force = Vector3.new(0,(car.DriveSeat.Velocity.Magnitude/-300)*F,0)
car.Body.DownforceR.T.Force = Vector3.new(0,(car.DriveSeat.Velocity.Magnitude/-300)*R,0)
car.Body.Drag.T.Force = Vector3.new(0,0,(car.DriveSeat.Velocity.magnitude^2*(Drag/30)))
end
hb:Connect(update)
|
--------------------------------------------------------------------------------
-- Popper.lua
-- Prevents your camera from clipping through walls.
--------------------------------------------------------------------------------
|
local Players = game:GetService('Players')
local FFlagUserPoppercamLooseOpacityThreshold do
local success, enabled = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserPoppercamLooseOpacityThreshold")
end)
FFlagUserPoppercamLooseOpacityThreshold = success and enabled
end
local camera = game.Workspace.CurrentCamera
local min = math.min
local tan = math.tan
local rad = math.rad
local inf = math.huge
local ray = Ray.new
local function eraseFromEnd(t, toSize)
for i = #t, toSize + 1, -1 do
t[i] = nil
end
end
local nearPlaneZ, projX, projY do
local function updateProjection()
local fov = rad(camera.FieldOfView)
local view = camera.ViewportSize
local ar = view.X/view.Y
projY = 2*tan(fov/2)
projX = ar*projY
end
camera:GetPropertyChangedSignal('FieldOfView'):Connect(updateProjection)
camera:GetPropertyChangedSignal('ViewportSize'):Connect(updateProjection)
updateProjection()
nearPlaneZ = camera.NearPlaneZ
camera:GetPropertyChangedSignal('NearPlaneZ'):Connect(function()
nearPlaneZ = camera.NearPlaneZ
end)
end
local blacklist = {} do
local charMap = {}
local function refreshIgnoreList()
local n = 1
blacklist = {}
for _, character in pairs(charMap) do
blacklist[n] = character
n = n + 1
end
end
local function playerAdded(player)
local function characterAdded(character)
charMap[player] = character
refreshIgnoreList()
end
local function characterRemoving()
charMap[player] = nil
refreshIgnoreList()
end
player.CharacterAdded:Connect(characterAdded)
player.CharacterRemoving:Connect(characterRemoving)
if player.Character then
characterAdded(player.Character)
end
end
local function playerRemoving(player)
charMap[player] = nil
refreshIgnoreList()
end
Players.PlayerAdded:Connect(playerAdded)
Players.PlayerRemoving:Connect(playerRemoving)
for _, player in ipairs(Players:GetPlayers()) do
playerAdded(player)
end
refreshIgnoreList()
end
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
script.Parent:WaitForChild("Speedo")
script.Parent:WaitForChild("Tach")
script.Parent:WaitForChild("ln")
script.Parent:WaitForChild("Gear")
script.Parent:WaitForChild("Speed")
local car = script.Parent.Parent.Car.Value
car.DriveSeat.HeadsUpDisplay = false
local _Tune = require(car["A-Chassis Tune"])
local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline
local revEnd = math.ceil(_lRPM/1000)
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
local maxSpeed = math.ceil(wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
local spInc = math.max(math.ceil(maxSpeed/200)*20,20)
for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = script.Parent.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
for i=1,90 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Speedo
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
for i=0,maxSpeed,spInc do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Speedo
ln.Rotation = 45 + 225*(i/maxSpeed)
ln.Num.Text = i
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)
script.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
end
script.Parent.Gear.Text = gearText
end)
script.Parent.Parent.Values.TCS.Changed:connect(function()
if script.Parent.Parent.Values.TCS.Value then
script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.TCSActive.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = true
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
end)
script.Parent.Parent.Values.TCSActive.Changed:connect(function()
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
else
wait()
script.Parent.TCS.Visible = false
end
end)
script.Parent.TCS.Changed:connect(function()
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
end
end)
script.Parent.Parent.Values.PBrake.Changed:connect(function()
script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end)
script.Parent.Parent.Values.TransmissionMode.Changed:connect(function()
if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
script.Parent.TMode.Text = "A/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
else
script.Parent.TMode.Text = "M/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
end
end)
script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speedo.Needle.Rotation =45 + 225 * math.min(1,script.Parent.Parent.Values.Velocity.Value.Magnitude/maxSpeed)
script.Parent.Speed.Text = math.floor(script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " SPS"
end)
|
-- The pierce function can also be used for things like bouncing.
-- In reality, it's more of a function that the module uses to ask "Do I end the cast now, or do I keep going?"
-- Because of this, you can use it for logic such as ray reflection or other redirection methods.
-- A great example might be to pierce or bounce based on something like velocity or angle.
-- You can see this implementation further down in the OnRayPierced function.
|
function CanRayPierce(cast, rayResult, segmentVelocity)
-- Let's keep track of how many times we've hit something.
local hits = cast.UserData.Hits
if (hits == nil) then
-- If the hit data isn't registered, set it to 1 (because this is our first hit)
cast.UserData.Hits = 1
else
-- If the hit data is registered, add 1.
cast.UserData.Hits += 1
end
-- And if the hit count is over 3, don't allow piercing and instead stop the ray.
if (cast.UserData.Hits > 3) then
return false
end
-- Now if we make it here, we want our ray to continue.
-- This is extra important! If a bullet bounces off of something, maybe we want it to do damage too!
-- So let's implement that.
local hitPart = rayResult.Instance
if hitPart ~= nil and hitPart.Parent ~= nil then
local humanoid = hitPart.Parent:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid:TakeDamage(10) -- Damage.
end
end
-- And then lastly, return true to tell FC to continue simulating.
return true
--[[
-- This function shows off the piercing feature literally. Pass this function as the last argument (after bulletAcceleration) and it will run this every time the ray runs into an object.
-- Do note that if you want this to work properly, you will need to edit the OnRayPierced event handler below so that it doesn't bounce.
if material == Enum.Material.Plastic or material == Enum.Material.Ice or material == Enum.Material.Glass or material == Enum.Material.SmoothPlastic then
-- Hit glass, plastic, or ice...
if hitPart.Transparency >= 0.5 then
-- And it's >= half transparent...
return true -- Yes! We can pierce.
end
end
return false
--]]
end
function Fire(direction)
-- Called when we want to fire the gun.
if Tool.Parent:IsA("Backpack") then return end -- Can't fire if it's not equipped.
-- Note: Above isn't in the event as it will prevent the CanFire value from being set as needed.
-- UPD. 11 JUNE 2019 - Add support for random angles.
local directionalCF = CFrame.new(Vector3.new(), direction)
-- Now, we can use CFrame orientation to our advantage.
-- Overwrite the existing Direction value.
local direction = (directionalCF * CFrame.fromOrientation(0, 0, RNG:NextNumber(0, TAU)) * CFrame.fromOrientation(math.rad(RNG:NextNumber(MIN_BULLET_SPREAD_ANGLE, MAX_BULLET_SPREAD_ANGLE)), 0, 0)).LookVector
-- UPDATE V6: Proper bullet velocity!
-- IF YOU DON'T WANT YOUR BULLETS MOVING WITH YOUR CHARACTER, REMOVE THE THREE LINES OF CODE BELOW THIS COMMENT.
-- Requested by https://www.roblox.com/users/898618/profile/
-- We need to make sure the bullet inherits the velocity of the gun as it fires, just like in real life.
local humanoidRootPart = Tool.Parent:WaitForChild("HumanoidRootPart", 1) -- Add a timeout to this.
local myMovementSpeed = humanoidRootPart.Velocity -- To do: It may be better to get this value on the clientside since the server will see this value differently due to ping and such.
local modifiedBulletSpeed = (direction * BULLET_SPEED)-- + myMovementSpeed -- We multiply our direction unit by the bullet speed. This creates a Vector3 version of the bullet's velocity at the given speed. We then add MyMovementSpeed to add our body's motion to the velocity.
if PIERCE_DEMO then
CastBehavior.CanPierceFunction = CanRayPierce
end
local simBullet = Caster:Fire(FirePointObject.WorldPosition, direction, modifiedBulletSpeed, CastBehavior)
-- Optionally use some methods on simBullet here if applicable.
-- Play the sound
PlayFireSound()
PlayReloadSound()
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
|
--// Return values: bool filterSuccess, bool resultIsFilterObject, variant result
|
function methods:InternalApplyRobloxFilterNewAPI(speakerName, message, textFilterContext) --// USES FFLAG
local alwaysRunFilter = false
local runFilter = RunService:IsServer() and not RunService:IsStudio()
if (alwaysRunFilter or runFilter) then
local fromSpeaker = self:GetSpeaker(speakerName)
if fromSpeaker == nil then
return false, nil, nil
end
local fromPlayerObj = fromSpeaker:GetPlayer()
if fromPlayerObj == nil then
return true, false, message
end
if allSpaces(message) then
return true, false, message
end
local success, filterResult = pcall(function()
local ts = game:GetService("TextService")
local result = ts:FilterStringAsync(message, fromPlayerObj.UserId, textFilterContext)
return result
end)
if (success) then
return true, true, filterResult
else
warn("Error filtering message:", message, filterResult)
self:InternalNotifyFilterIssue()
return false, nil, nil
end
end
--// Simulate filtering latency.
wait()
return true, false, message
end
function methods:InternalDoMessageFilter(speakerName, messageObj, channel)
local filtersIterator = self.FilterMessageFunctions:GetIterator()
for funcId, func, priority in filtersIterator do
local success, errorMessage = pcall(function()
func(speakerName, messageObj, channel)
end)
if not success then
warn(string.format("DoMessageFilter Function '%s' failed for reason: %s", funcId, errorMessage))
end
end
end
function methods:InternalDoProcessCommands(speakerName, message, channel)
local commandsIterator = self.ProcessCommandsFunctions:GetIterator()
for funcId, func, priority in commandsIterator do
local success, returnValue = pcall(function()
local ret = func(speakerName, message, channel)
if type(ret) ~= "boolean" then
error("Process command functions must return a bool")
end
return ret
end)
if not success then
warn(string.format("DoProcessCommands Function '%s' failed for reason: %s", funcId, returnValue))
elseif returnValue then
return true
end
end
return false
end
function methods:InternalGetUniqueMessageId()
local id = self.MessageIdCounter
self.MessageIdCounter = id + 1
return id
end
function methods:InternalAddSpeakerWithPlayerObject(speakerName, playerObj, fireSpeakerAdded)
if (self.Speakers[speakerName:lower()]) then
error("Speaker \"" .. speakerName .. "\" already exists!")
end
local speaker = Speaker.new(self, speakerName)
speaker:InternalAssignPlayerObject(playerObj)
self.Speakers[speakerName:lower()] = speaker
if fireSpeakerAdded then
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error adding speaker: " ..err)
end
end
return speaker
end
function methods:InternalFireSpeakerAdded(speakerName)
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error firing speaker added: " ..err)
end
end
|
-- Render the map at 0FPS (static since we know it doesn't change)
|
for i,d in pairs(workspace.Map:GetDescendants()) do
if d:IsA("BasePart") then
local mapObj_Handler = VF_Handler:RenderObject(d)
end
end
|
--create tables:
|
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "e" then
table.insert(e, 1, part)
end
end
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "f" then
table.insert(f, 1, part)
end
end
function lightOn(T)
for i, part in pairs (T) do
if part:FindFirstChild("On") then
part.On.Value = true
end
end
end
function lightOff(T)
for i, part in pairs (T) do
if part:FindFirstChild("On") then
part.On.Value = false
end
end
end
while true do
lightOn(e)
wait(0.25)
lightOff(e)
wait(0.25)
lightOn(f)
wait(0.25)
lightOff(f)
wait(0.25)
end
|
--created on December 2, 2016 at 11:44 pm
|
local currentTurn = "X"
local lastFirstMove = "X"
local moveCount = 0
local isGameReady = true
function resetGame()
if lastFirstMove == "X" then
lastFirstMove = "O"
else
lastFirstMove = "X"
end
currentTurn = lastFirstMove
moveCount = 0
for j = 0, 1, 0.02 do
for i = 1, 9 do
if script.Parent["X"..i].Transparency ~= 1 then
script.Parent["X"..i].Transparency = j
end
if script.Parent["O"..i].Transparency ~= 1 then
script.Parent["O"..i].Transparency = j
end
end
for i = 1, 8 do
if script.Parent["Win"..i].Transparency ~= 1 then
script.Parent["Win"..i].Transparency = j
end
end
if script.Parent.Cat.Transparency ~= 1 then
script.Parent.Cat.Transparency = j
end
wait()
end
for i = 1, 9 do
script.Parent["X"..i].Transparency = 1
script.Parent["O"..i].Transparency = 1
end
for i = 1, 8 do
script.Parent["Win"..i].Transparency = 1
end
script.Parent.Cat.Transparency = 1
isGameReady = true
end
function winGame(num)
isGameReady = false
if currentTurn == "X" then
print("X won!")
else
print("O won!")
end
script.Parent["Win"..num].Transparency = 0
wait(2)
resetGame()
end
function tieGame()
isGameReady = false
print("It was a tie!")
script.Parent.Cat.Transparency = 0
wait(2)
resetGame()
end
function checkForWin()
if script.Parent[currentTurn.. 1].Transparency == 0 and
script.Parent[currentTurn.. 2].Transparency == 0 and
script.Parent[currentTurn.. 3].Transparency == 0 then
winGame(4)
return
elseif script.Parent[currentTurn.. 1].Transparency == 0 and
script.Parent[currentTurn.. 4].Transparency == 0 and
script.Parent[currentTurn.. 7].Transparency == 0 then
winGame(1)
return
elseif script.Parent[currentTurn.. 1].Transparency == 0 and
script.Parent[currentTurn.. 5].Transparency == 0 and
script.Parent[currentTurn.. 9].Transparency == 0 then
winGame(7)
return
elseif script.Parent[currentTurn.. 2].Transparency == 0 and
script.Parent[currentTurn.. 5].Transparency == 0 and
script.Parent[currentTurn.. 8].Transparency == 0 then
winGame(2)
return
elseif script.Parent[currentTurn.. 3].Transparency == 0 and
script.Parent[currentTurn.. 5].Transparency == 0 and
script.Parent[currentTurn.. 7].Transparency == 0 then
winGame(8)
return
elseif script.Parent[currentTurn.. 3].Transparency == 0 and
script.Parent[currentTurn.. 6].Transparency == 0 and
script.Parent[currentTurn.. 9].Transparency == 0 then
winGame(3)
return
elseif script.Parent[currentTurn.. 4].Transparency == 0 and
script.Parent[currentTurn.. 5].Transparency == 0 and
script.Parent[currentTurn.. 6].Transparency == 0 then
winGame(5)
return
elseif script.Parent[currentTurn.. 7].Transparency == 0 and
script.Parent[currentTurn.. 8].Transparency == 0 and
script.Parent[currentTurn.. 9].Transparency == 0 then
winGame(6)
return
elseif moveCount == 9 then
tieGame()
end
end
function setPiece(num)
if not getSpotState(num) and isGameReady then
script.Parent[currentTurn..num].Transparency = 0
moveCount = moveCount + 1
wait()
checkForWin()
if currentTurn == "X" then
currentTurn = "O"
else
currentTurn = "X"
end
end
end
function getSpotState(num)
if script.Parent["X"..num].Transparency == 0 then
return "X"
elseif script.Parent["O"..num].Transparency == 0 then
return "O"
else
return false
end
end
for i = 1, 9 do
script.Parent["Detector"..i].ClickDetector.MouseClick:connect(function()
setPiece(i)
end)
end
|
--If you want to get teleported to a specific Model, enter the name of the model you want to go to here.
------------------------------------
|
modelname="tele2"
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
|
local toolAnimName = ""
local toolAnimTrack = nil
local toolAnimInstance = nil
local currentToolAnimKeyframeHandler = nil
function toolKeyFrameReachedFunc(frameName)
if (frameName == "End") then
playToolAnimation(toolAnimName, 0.0, Humanoid)
end
end
function playToolAnimation(animName, transitionTime, humanoid, priority)
local idx = rollAnimation(animName)
local anim = animTable[animName][idx].anim
if (toolAnimInstance ~= anim) then
if (toolAnimTrack ~= nil) then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
transitionTime = 0
end
-- load it to the humanoid; get AnimationTrack
toolAnimTrack = humanoid:LoadAnimation(anim)
if priority then
toolAnimTrack.Priority = priority
end
-- play the animation
toolAnimTrack:Play(transitionTime)
toolAnimName = animName
toolAnimInstance = anim
currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:Connect(toolKeyFrameReachedFunc)
end
end
function stopToolAnimations()
local oldAnim = toolAnimName
if (currentToolAnimKeyframeHandler ~= nil) then
currentToolAnimKeyframeHandler:Disconnect()
end
toolAnimName = ""
toolAnimInstance = nil
if (toolAnimTrack ~= nil) then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
toolAnimTrack = nil
end
return oldAnim
end
|
--!strict
|
local Sift = script.Parent.Parent
local copy = require(Sift.Dictionary.copy)
|
-- This will say "edited"
|
Notification.OnServerEvent:Connect(function(plr)
Notification:FireClient(plr,false)
end)
|
-- helper functions
|
local function removePlayerNameFromStack(stack)
-- in order to generalize the data so that errors are properly grouped,
-- we must strip out any personal information from the callstack.
if not type(stack) == "string" then
warn(string.format("Expected stack to be a string, received : %s", type(stack)))
return tostring(stack)
end
local sanitizedStack = string.gsub(stack, "Players%.[^.]+%.", "Players.<Player>.")
return sanitizedStack
end
local ErrorReporter = {}
ErrorReporter.__index = ErrorReporter
function ErrorReporter.new(networkingImpl)
if not networkingImpl then
networkingImpl = Networking.new()
end
local er = {
-- reporter implementations
_googleAnalyticsReporter = ReporterGoogleAnalytics.new({
networking = networkingImpl,
}),
_playFabReporter = ReporterPlayFab.new(),
}
setmetatable(er, ErrorReporter)
return er
end
|
--Workspace.CurrentCamera.CameraSubject=game.Players.LocalPlayer.Character.Humanoid
--Workspace.CurrentCamera.CameraType="Custom"
|
bin.Name = "Vehicle"
end)
game.Players.LocalPlayer.Character.Humanoid.Changed:connect(function()
if game.Players.LocalPlayer.Character.Humanoid.Jump then
script.Parent:remove()
end
end)
|
--[=[
Constructs a new promise.
::warning
Do not yield within this func callback, as it will yield on the
main thread. This is a performance optimization.
::
@param func (resolve: (...) -> (), reject: (...) -> ()) -> ()?
@return Promise<T>
]=]
|
function Promise.new(func)
local self = setmetatable({
_pendingExecuteList = {};
_unconsumedException = true;
_source = ENABLE_TRACEBACK and debug.traceback() or "";
}, Promise)
if type(func) == "function" then
func(self:_getResolveReject())
end
return self
end
|
--[=[
@function copy
@within Set
@param set { [T]: boolean } -- The set to copy.
@return { [T]: boolean } -- A copy of the set.
Creates a copy of a set.
```lua
local set = { hello = true }
local newSet = Copy(set) -- { hello = true }
```
]=]
|
return copy
|
--[[
Keeping track of the players leaving, in case more Ownerships (dinosaurs, essentially) are in play in the level.
Generalized the functionality so each new instance of Ownership doesn't have it's own event-tracker.
--]]
|
game:GetService("Players").PlayerRemoving:Connect(function(Player)
if Owners[Player] then
Owners[Player]:SetOwner(nil)
Owners[Player] = nil
end
end)
return Ownership
|
--if (script.Parent ~= nil) and (script.Parent.className == "Part") then --Work if in a block
-- connection = script.Parent.Touched:connect(onTouched)
--end
|
script.Parent.Touched:connect(onTouched)
|
--[=[
The same as [Promise.new](/api/Promise#new), except execution begins after the next `Heartbeat` event.
This is a spiritual replacement for `spawn`, but it does not suffer from the same [issues](https://eryn.io/gist/3db84579866c099cdd5bb2ff37947cec) as `spawn`.
```lua
local function waitForChild(instance, childName, timeout)
return Promise.defer(function(resolve, reject)
local child = instance:WaitForChild(childName, timeout)
;(child and resolve or reject)(child)
end)
end
```
@param executor (resolve: (...: any) -> (), reject: (...: any) -> (), onCancel: (abortHandler: () -> boolean)) -> ()
@return Promise
]=]
|
function Promise.defer(callback)
local traceback = debug.traceback(nil, 2)
local promise
promise = Promise._new(traceback, function(resolve, reject, onCancel)
local connection
connection = Promise._timeEvent:Connect(function()
connection:Disconnect()
local ok, _, result = runExecutor(traceback, callback, resolve, reject, onCancel)
if not ok then
reject(result[1])
end
end)
end)
return promise
end
|
--[[ CLIMAXIMUS's sprint script. Made by request. ]]
|
--
local RunSpeed = 28 --[[ <-- The sprinting speed. ]]--
|
--// SS3 controls for AC6 by Itzt, originally for 2014 Infiniti QX80. i don't know how to tune ac lol
|
wait(0.1)
local player = game.Players.LocalPlayer
local carSeat = script.Parent.CarSeat.Value
local mouse = game.Players.LocalPlayer:GetMouse()
local windows = false
local winfob = script.Parent.Music
local handler = carSeat:WaitForChild('Filter')
local HUB2 = script.Parent.HUB2
|
--local Pitch = script.Parent.Handle.FireSound
|
local MyPlayer = nil
local MyCharacter = nil
local MyHumanoid = nil
local MyTorso = nil
local MyMouse = nil
local RecoilAnim
local RecoilTrack = nil
local ReloadAnim
local ReloadTrack = nil
local IconURL = Tool.TextureId
local DebrisService = game:GetService('Debris')
local PlayersService = game:GetService('Players')
|
--[[ Public API ]]
|
--
function Gamepad:Enable()
local forwardValue = 0
local backwardValue = 0
local leftValue = 0
local rightValue = 0
local moveFunc = LocalPlayer.Move
local gamepadSupports = UserInputService.GamepadSupports
local controlCharacterGamepad1 = function(actionName, inputState, inputObject)
if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 then return end
if inputObject.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end
if hasCancelType and inputState == Enum.UserInputState.Cancel then
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
return
end
if inputObject.Position.magnitude > thumbstickDeadzone then
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(inputObject.Position.X, 0, -inputObject.Position.Y)
MasterControl:AddToPlayerMovement(currentMoveVector)
else
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
end
end
local jumpCharacterGamepad1 = function(actionName, inputState, inputObject)
if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 then return end
if inputObject.KeyCode ~= Enum.KeyCode.ButtonA then return end
if hasCancelType and inputState == Enum.UserInputState.Cancel then
MasterControl:SetIsJumping(false)
return
end
MasterControl:SetIsJumping(inputObject.UserInputState == Enum.UserInputState.Begin)
end
local doDpadMoveUpdate = function()
if not gamepadSupports(UserInputService, Enum.UserInputType.Gamepad1, Enum.KeyCode.Thumbstick1) then
if LocalPlayer and LocalPlayer.Character then
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(leftValue + rightValue,0,forwardValue + backwardValue)
MasterControl:AddToPlayerMovement(currentMoveVector)
end
end
end
local moveForwardFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End then
forwardValue = -1
elseif inputState == Enum.UserInputState.Begin or (hasCancelType and inputState == Enum.UserInputState.Cancel) then
forwardValue = 0
end
doDpadMoveUpdate()
end
local moveBackwardFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End then
backwardValue = 1
elseif inputState == Enum.UserInputState.Begin or (hasCancelType and inputState == Enum.UserInputState.Cancel) then
backwardValue = 0
end
doDpadMoveUpdate()
end
local moveLeftFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End then
leftValue = -1
elseif inputState == Enum.UserInputState.Begin or (hasCancelType and inputState == Enum.UserInputState.Cancel) then
leftValue = 0
end
doDpadMoveUpdate()
end
local moveRightFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End then
rightValue = 1
elseif inputState == Enum.UserInputState.Begin or (hasCancelType and inputState == Enum.UserInputState.Cancel) then
rightValue = 0
end
doDpadMoveUpdate()
end
ContextActionService:BindAction("JumpButton",jumpCharacterGamepad1, false, Enum.KeyCode.ButtonA)
ContextActionService:BindAction("MoveThumbstick",controlCharacterGamepad1, false, Enum.KeyCode.Thumbstick1)
ContextActionService:BindAction("forwardDpad", moveForwardFunc, false, Enum.KeyCode.DPadUp)
ContextActionService:BindAction("backwardDpad", moveBackwardFunc, false, Enum.KeyCode.DPadDown)
ContextActionService:BindAction("leftDpad", moveLeftFunc, false, Enum.KeyCode.DPadLeft)
ContextActionService:BindAction("rightDpad", moveRightFunc, false, Enum.KeyCode.DPadRight)
ContextActionService:BindActivate(Enum.UserInputType.Gamepad1, Enum.KeyCode.ButtonR2)
UserInputService.GamepadDisconnected:connect(function(gamepadEnum)
if gamepadEnum ~= Enum.UserInputType.Gamepad1 then return end
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
end)
UserInputService.GamepadConnected:connect(function(gamepadEnum)
if gamepadEnum ~= Enum.UserInputType.Gamepad1 then return end
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
end)
end
function Gamepad:Disable()
ContextActionService:UnbindAction("forwardDpad")
ContextActionService:UnbindAction("backwardDpad")
ContextActionService:UnbindAction("leftDpad")
ContextActionService:UnbindAction("rightDpad")
ContextActionService:UnbindAction("MoveThumbstick")
ContextActionService:UnbindAction("JumpButton")
ContextActionService:UnbindActivate(Enum.UserInputType.Gamepad1, Enum.KeyCode.ButtonR2)
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
end
return Gamepad
|
-- Vector3 and Position --
|
local part = game.Workspace.PositionPart
part.Size = Vector3.new(8, 8, 8)
part.Position = Vector3.new(10, 10, 10)
part.Position = part.Position + Vector3.new(5, 5, 5) -- (15, 15, 15)
part.Position += Vector3.new(5, 5, 5) --also works
|
-- You may turn both of these on at once. In that case, zone-specific music will play in the appropriate zones, and global background music will play whenever you're not within any zone.
|
settings.DisplayMuteButton = false -- If set to true, there will be a button in the bottom-right corner of the screen allowing players to mute the background music.
settings.MusicFadeoutTime = 1 -- How long music takes to fade out, in seconds.
settings.MusicOnlyPlaysWithinZones = false -- (This setting only applies when UseGlobalBackgroundMusic is set to false) If a player walks into an area that's not covered by any music zone, what should happen? If true, music will stop playing. If false, the music from the previous zone will continue to play.
return settings
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.