prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--Made by Luckymaxer
|
Model = script.Parent
Debris = game:GetService("Debris")
Creator = script:FindFirstChild("Creator")
Tool = script:FindFirstChild("Tool")
FadeRate = 0.025
Rate = (1 / 15)
Removing = false
function DestroyModel()
if Removing then
return
end
Model.Name = ""
for i, v in pairs(Model:GetChildren()) do
if v:IsA("BasePart") then
v.Transparency = 1
v.Anchored = true
v.CanCollide = false
for ii, vv in pairs(v:GetChildren()) do
if vv:IsA("Fire") or vv:IsA("Smoke") or vv:IsA("Sparkles") or vv:IsA("Light") or vv:IsA("ParticleEmitter") then
vv.Enabled = false
end
end
end
end
Removing = true
Debris:AddItem(Model, 1.5)
end
function ClearModel()
if Removing then
return
end
local Parts = {}
for i, v in pairs(Model:GetChildren()) do
if v:IsA("BasePart") then
table.insert(Parts, v)
end
end
if #Parts == 0 then
Removing = true
Model.Name = ""
Debris:AddItem(Model, 0.5)
end
end
if not Creator or not Creator.Value or not Creator.Value:IsA("Player") or not Creator.Value.Parent or not Tool or not Tool.Value or not Tool.Value.Parent then
DestroyModel()
return
end
Creator = Creator.Value
Tool = Tool.Value
Character = Creator.Character
if not Character then
DestroyModel()
return
end
Creator.Changed:connect(function(Property)
if Property == "Parent" and not Creator.Parent then
DestroyModel()
end
end)
Character.Changed:connect(function(Property)
if Property == "Parent" and not Character.Parent then
DestroyModel()
end
end)
Tool.Changed:connect(function(Property)
if Property == "Parent" then
DestroyModel()
end
end)
Model.ChildRemoved:connect(function(Child)
ClearModel()
end)
wait(1)
ClearModel()
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================
|
local function exit()
local raceStatus = RaceManager:GetRaceStatus()
if raceStatus == RaceManager.Status.WaitingForPlayers or
raceStatus == RaceManager.Status.WaitingForRaceToStart then
RemoveActivePlayer:FireServer()
else
PlayerConverter:SpeederToPlayer()
end
end -- exit()
|
-- goro7
|
local plr = game.Players.LocalPlayer
function update()
-- Calculate scale
local scale = (plr.PlayerGui.MainGui.AbsoluteSize.Y + 2) / script.Parent.Parent.Size.Y.Offset
if scale > 1.5 then
scale = 1.5
end
if scale > 0 then
script.Parent.Scale = scale
end
end
plr.PlayerGui:WaitForChild("MainGui"):GetPropertyChangedSignal("AbsoluteSize"):connect(update)
update()
|
--[[
For each point on each line, find the values of the other sequence at that point in time through interpolation
then interpolate between the known value and the learned value
then use that value to create a new keypoint at the time
then build a new sequence using all the keypoints generated
--]]
|
local sortByTime = function(a, b)
return a.Time < b.Time
end
return function(a, b, t)
local keypoints = {}
local addedTimes = {}
for i, ap in next, a.Keypoints do
local closestAbove, closestBelow
for i, bp in next, b.Keypoints do
if bp.Time == ap.Time then
closestAbove, closestBelow = bp, bp
break
elseif bp.Time < ap.Time and (closestBelow == nil or bp.Time > closestBelow.Time) then
closestBelow = bp
elseif bp.Time > ap.Time and (closestAbove == nil or bp.Time < closestAbove.Time) then
closestAbove = bp
end
end
local bValue, bEnvelope
if closestAbove == closestBelow then
bValue, bEnvelope = closestAbove.Value, closestAbove.Envelope
else
local p = (ap.Time - closestBelow.Time)/(closestAbove.Time - closestBelow.Time)
bValue = (closestAbove.Value - closestBelow.Value)*p + closestBelow.Value
bEnvelope = (closestAbove.Envelope - closestBelow.Envelope)*p + closestBelow.Envelope
end
local interValue = (bValue - ap.Value)*t + ap.Value
local interEnvelope = (bEnvelope - ap.Envelope)*t + ap.Envelope
local interp = NumberSequenceKeypoint.new(ap.Time, interValue, interEnvelope)
table.insert(keypoints, interp)
addedTimes[ap.Time] = true
end
for i, bp in next, b.Keypoints do
if not addedTimes[bp.Time] then
local closestAbove, closestBelow
for i, ap in next, a.Keypoints do
if ap.Time == bp.Time then
closestAbove, closestBelow = ap, ap
break
elseif ap.Time < bp.Time and (closestBelow == nil or ap.Time > closestBelow.Time) then
closestBelow = ap
elseif ap.Time > bp.Time and (closestAbove == nil or ap.Time < closestAbove.Time) then
closestAbove = ap
end
end
local aValue, aEnvelope
if closestAbove == closestBelow then
aValue, aEnvelope = closestAbove.Value, closestAbove.Envelope
else
local p = (bp.Time - closestBelow.Time)/(closestAbove.Time - closestBelow.Time)
aValue = (closestAbove.Value - closestBelow.Value)*p + closestBelow.Value
aEnvelope = (closestAbove.Envelope - closestBelow.Envelope)*p + closestBelow.Envelope
end
local interValue = (bp.Value - aValue)*t + aValue
local interEnvelope = (bp.Envelope - aEnvelope)*t + aEnvelope
local interp = NumberSequenceKeypoint.new(bp.Time, interValue, interEnvelope)
table.insert(keypoints, interp)
end
end
table.sort(keypoints, sortByTime)
return NumberSequence.new(keypoints)
end
|
--[[Wheel Stabilizer Gyro]]
|
Tune.FGyroDamp = 200 -- Front Wheel Non-Axial Dampening
Tune.RGyroDamp = 200 -- Rear Wheel Non-Axial Dampening
|
--[=[
@param matches {Some: (value: any) -> any, None: () -> any}
@return any
Matches against the option.
```lua
local opt = Option.Some(32)
opt:Match {
Some = function(num) print("Number", num) end,
None = function() print("No value") end,
}
```
]=]
|
function Option:Match(matches)
local onSome = matches.Some
local onNone = matches.None
assert(type(onSome) == "function", "Missing 'Some' match")
assert(type(onNone) == "function", "Missing 'None' match")
if self:IsSome() then
return onSome(self:Unwrap())
else
return onNone()
end
end
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local methods = {}
methods.__index = methods
function methods:SendSystemMessage(message, extraData)
local messageObj = self:InternalCreateMessageObject(message, nil, true, extraData)
local success, err = pcall(function() self.eMessagePosted:Fire(messageObj) end)
if not success and err then
print("Error posting message: " ..err)
end
self:InternalAddMessageToHistoryLog(messageObj)
for i, speaker in pairs(self.Speakers) do
speaker:InternalSendSystemMessage(messageObj, self.Name)
end
return messageObj
end
function methods:SendSystemMessageToSpeaker(message, speakerName, extraData)
local speaker = self.Speakers[speakerName]
if (speaker) then
local messageObj = self:InternalCreateMessageObject(message, nil, true, extraData)
speaker:InternalSendSystemMessage(messageObj, self.Name)
else
warn(string.format("Speaker '%s' is not in channel '%s' and cannot be sent a system message", speakerName, self.Name))
end
end
function methods:SendMessageObjToFilters(message, messageObj, fromSpeaker)
local oldMessage = messageObj.Message
messageObj.Message = message
self:InternalDoMessageFilter(fromSpeaker.Name, messageObj, self.Name)
self.ChatService:InternalDoMessageFilter(fromSpeaker.Name, messageObj, self.Name)
local newMessage = messageObj.Message
messageObj.Message = oldMessage
return newMessage
end
function methods:CanCommunicateByUserId(userId1, userId2)
|
--[[**
creates a union type
@param ... The checks to union
@returns A function that will return true iff the condition is passed
**--]]
|
function t.union(...)
local checks = { ... }
assert(callbackArray(checks))
return function(value)
for _, check in ipairs(checks) do
if check(value) then
return true
end
end
return false
end
end
|
--[[The local script included in this model can only be used if
1. The weapon is being placed in the players backpack first (i.e. the weapon is in starterpack and moves to player backpack)
OR
2. The weapon is previously welded (weapon can be placed in workspace and picked up then)
]]
|
repeat wait() until script.Parent:FindFirstChild("Handle")
local welds={}
function ClearOldWelds(tbl)
for _,v in pairs(tbl) do
if v:IsA('Weld') then
v:Destroy()
end
end
end
function Equipped()
local handle=script.Parent:FindFirstChild('Handle')
if not handle then return end
local tble=handle:GetChildren()
for _,v in pairs(script.Parent:GetChildren()) do
if v:IsA('BasePart') and v~=handle then
local c1
for _1,v1 in pairs(welds) do
if _1==v then
c1=v1
break
end
end
if not c1 then
welds[v]=v.CFrame:inverse()*handle.CFrame
v.Anchored=false
c1=welds[v]
end
local weld=Instance.new('Weld')
weld.Part0=handle
weld.Part1=v
weld.C0=CFrame.new()
weld.C1=c1
weld.Parent=handle
end
end
ClearOldWelds(tble)
handle.Anchored=false
end
Equipped()
script.Parent.Equipped:connect(Equipped)
|
-- ROBLOX deviation: Tester type defined in file since type imports are not yet
-- supported
-- making Tester return type 'any' due to error with type narrowing (CLI-37948)
| |
--[=[
Returns `true` if the property object is ready to be
used. In other words, it has successfully gained
connection to the server-side version and has synced
in the initial value.
```lua
if clientRemoteProperty:IsReady() then
local value = clientRemoteProperty:Get()
end
```
]=]
|
function ClientRemoteProperty:IsReady(): boolean
return self._ready
end
|
------------------------------------------------------------------------
--
-- * used only in luaK:codearith()
------------------------------------------------------------------------
|
function luaK:constfolding(op, e1, e2)
local r
if not self:isnumeral(e1) or not self:isnumeral(e2) then return false end
local v1 = e1.nval
local v2 = e2.nval
if op == "OP_ADD" then
r = self:numadd(v1, v2)
elseif op == "OP_SUB" then
r = self:numsub(v1, v2)
elseif op == "OP_MUL" then
r = self:nummul(v1, v2)
elseif op == "OP_DIV" then
if v2 == 0 then return false end -- do not attempt to divide by 0
r = self:numdiv(v1, v2)
elseif op == "OP_MOD" then
if v2 == 0 then return false end -- do not attempt to divide by 0
r = self:nummod(v1, v2)
elseif op == "OP_POW" then
r = self:numpow(v1, v2)
elseif op == "OP_UNM" then
r = self:numunm(v1)
elseif op == "OP_LEN" then
return false -- no constant folding for 'len'
else
assert(0)
r = 0
end
if self:numisnan(r) then return false end -- do not attempt to produce NaN
e1.nval = r
return true
end
|
--rope.BrickColor = BrickColor.new("Black")
|
rope.TopSurface = 0
rope.BottomSurface = 0
rope.formFactor = "Symmetric"
rope.Name = "Rope"
rope.CanCollide = false
rope.Anchored = true
local mesh = Instance.new("CylinderMesh")
mesh.Parent = rope
|
--[=[
Converts a set to a list
@param set table
@return table
]=]
|
function Set.toList(set)
local list = {}
for value, _ in pairs(set) do
table.insert(list, value)
end
return list
end
|
-- Called when any relevant values of GameSettings or LocalPlayer change, forcing re-evalulation of
-- current control scheme
|
function ControlModule:OnComputerMovementModeChange()
local controlModule, success = self:SelectComputerMovementModule()
if success then
self:SwitchToController(controlModule)
end
end
function ControlModule:OnTouchMovementModeChange()
local touchModule, success = self:SelectTouchModule()
if success then
while not self.touchControlFrame do
wait()
end
self:SwitchToController(touchModule)
end
end
function ControlModule:CreateTouchGuiContainer()
if self.touchGui then self.touchGui:Destroy() end
-- Container for all touch device guis
self.touchGui = Instance.new("ScreenGui")
self.touchGui.Name = "TouchGui"
self.touchGui.ResetOnSpawn = false
self.touchGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
self:UpdateTouchGuiVisibility()
self.touchControlFrame = Instance.new("Frame")
self.touchControlFrame.Name = "TouchControlFrame"
self.touchControlFrame.Size = UDim2.new(1, 0, 1, 0)
self.touchControlFrame.BackgroundTransparency = 1
self.touchControlFrame.Parent = self.touchGui
self.touchGui.Parent = self.playerGui
end
function ControlModule:GetClickToMoveController()
if not self.controllers[ClickToMove] then
self.controllers[ClickToMove] = ClickToMove.new(CONTROL_ACTION_PRIORITY)
end
return self.controllers[ClickToMove]
end
return ControlModule.new()
|
--[=[
@class ClientComm
@client
]=]
|
local ClientComm = {}
ClientComm.__index = ClientComm
|
--[[
@class ClientMain
]]
|
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local packages = ReplicatedFirst:WaitForChild("_SoftShutdownClientPackages")
local SoftShutdownServiceClient = require(packages.SoftShutdownServiceClient)
local serviceBag = require(packages.ServiceBag).new()
serviceBag:GetService(SoftShutdownServiceClient)
serviceBag:Init()
serviceBag:Start()
|
--// This module is for stuff specific to cross server communication
--// NOTE: THIS IS NOT A *CONFIG/USER* PLUGIN! ANYTHING IN THE MAINMODULE PLUGIN FOLDERS IS ALREADY PART OF/LOADED BY THE SCRIPT! DO NOT ADD THEM TO YOUR CONFIG>PLUGINS FOLDER!
|
return function(Vargs, GetEnv)
local env = GetEnv(nil, {script = script})
setfenv(1, env)
local server = Vargs.Server;
local service = Vargs.Service;
local Settings = server.Settings
local Functions, Commands, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Deps =
server.Functions, server.Commands, server.Admin, server.Anti, server.Core, server.HTTP, server.Logs, server.Remote, server.Process, server.Variables, server.Deps
-- // Remove legacy trello board
local epix_board_index = type(Settings.Trello_Secondary) == "table" and table.find(Settings.Trello_Secondary, "9HH6BEX2")
if epix_board_index then
table.remove(Settings.Trello_Secondary, epix_board_index)
Logs:AddLog("Script", "Removed legacy trello board")
end
Logs:AddLog("Script", "Misc Features Module Loaded")
end
|
-- ================================================================================
-- EVENTS
-- ================================================================================
|
local buttonDown = Instance.new("BindableEvent")
local buttonUp = Instance.new("BindableEvent")
local changed = Instance.new("BindableEvent")
local connected = Instance.new("BindableEvent")
local disconnected = Instance.new("BindableEvent")
Gamepad.ButtonDown = buttonDown.Event
Gamepad.ButtonUp = buttonUp.Event
Gamepad.Changed = changed.Event
Gamepad.Connected = connected.Event
Gamepad.Disconnected = disconnected.Event
|
-- If in-game, enable ctrl hotkeys for undoing and redoing
|
if Mode == 'Tool' then
AssignHotkey({ 'LeftControl', 'Z' }, History.Undo);
AssignHotkey({ 'RightControl', 'Z' }, History.Undo);
AssignHotkey({ 'LeftControl', 'Y' }, History.Redo);
AssignHotkey({ 'RightControl', 'Y' }, History.Redo);
end;
local function GetDepthFromAncestor(Item, Ancestor)
-- Returns the depth of `Item` from `Ancestor`
local Depth = 0
-- Go through ancestry until reaching `Ancestor`
while Item ~= Ancestor do
Depth = Depth + 1
Item = Item.Parent
end
-- Return depth
return Depth
end
local function GetHighestParent(Items)
local HighestItem, HighestItemDepth
-- Calculate depth of each item & keep highest
for _, Item in ipairs(Items) do
local Depth = GetDepthFromAncestor(Item, game)
if (not HighestItemDepth) or (Depth < HighestItemDepth) then
HighestItem = Item
HighestItemDepth = Depth
end
end
-- Return parent of highest item
return HighestItem and HighestItem.Parent or nil
end
function CloneSelection()
-- Clones selected parts
-- Make sure that there are items in the selection
if #Selection.Items == 0 then
return;
end;
-- Send the cloning request to the server
local Clones = SyncAPI:Invoke('Clone', Selection.Items, GetHighestParent(Selection.Items))
-- Put together the history record
local HistoryRecord = {
Clones = Clones;
Unapply = function (HistoryRecord)
-- Reverts this change
-- Deselect the clones
Selection.Remove(HistoryRecord.Clones, false);
-- Remove the clones
SyncAPI:Invoke('Remove', HistoryRecord.Clones);
end;
Apply = function (HistoryRecord)
-- Reapplies this change
-- Restore the clones
SyncAPI:Invoke('UndoRemove', HistoryRecord.Clones);
end;
};
-- Register the history record
History.Add(HistoryRecord);
-- Select the clones
Selection.Replace(Clones);
-- Flash the outlines of the new parts
coroutine.wrap(Selection.FlashOutlines)();
end;
function DeleteSelection()
-- Deletes selected items
-- Put together the history record
local HistoryRecord = {
Parts = Support.CloneTable(Selection.Items);
Unapply = function (HistoryRecord)
-- Reverts this change
-- Restore the parts
SyncAPI:Invoke('UndoRemove', HistoryRecord.Parts);
-- Select the restored parts
Selection.Replace(HistoryRecord.Parts);
end;
Apply = function (HistoryRecord)
-- Applies this change
-- Deselect the parts
Selection.Remove(HistoryRecord.Parts, false);
-- Remove the parts
SyncAPI:Invoke('Remove', HistoryRecord.Parts);
end;
};
-- Deselect parts before deleting
Selection.Remove(HistoryRecord.Parts, false);
-- Perform the removal
SyncAPI:Invoke('Remove', HistoryRecord.Parts);
-- Register the history record
History.Add(HistoryRecord);
end;
|
-- My version of Promise has PascalCase, but I converted it to use lowerCamelCase for this release since obviously that's important to do.
| |
--Set up teleport arrival.
|
TeleportService.LocalPlayerArrivedFromTeleport:Connect(function(Gui,Data)
if Data and Data.IsTemporaryServer then
--If it is a temporary server, keep showing the Gui, wait, then teleport back.
Gui.Parent = Players.LocalPlayer:WaitForChild("PlayerGui",10^99)
StarterGui:SetCore("TopbarEnabled",false)
StarterGui:SetCoreGuiEnabled("All",false)
task.wait(5)
TeleportService:Teleport(Data.PlaceId,Players.LocalPlayer,nil,Gui)
else
--If the player is arriving back from a temporary server, remove the Gui.
if Gui and Gui.Name == "SoftShutdownGui" then Gui:Destroy() end
end
end)
|
--//Script\\--
|
function whileTouching()
--wait(4)
script.Parent.AutomaticT.Disabled = false
script.Parent.Lighted.Disabled = false
end
function letGo()
script.Parent.AutomaticT.Disabled = true
script.Parent.Lighted.Disabled = true
script.Parent.LightedOff.Disabled = false
end
|
-- ROBLOX TODO: fix PrettyFormat types imports
|
type PrettyFormatOptions = PrettyFormat_.PrettyFormatOptions
local chalk = require(Packages.ChalkLua)
local getType = require(Packages.JestGetType).getType
local cleanupSemanticModule = require(CurrentModule.CleanupSemantic)
local DIFF_DELETE = cleanupSemanticModule.DIFF_DELETE
local DIFF_EQUAL = cleanupSemanticModule.DIFF_EQUAL
local DIFF_INSERT = cleanupSemanticModule.DIFF_INSERT
local Diff = cleanupSemanticModule.Diff
export type Diff = cleanupSemanticModule.Diff
local normalizeDiffOptions = require(CurrentModule.NormalizeDiffOptions).normalizeDiffOptions
local diffLinesRaw = require(CurrentModule.DiffLines).diffLinesRaw
local diffLinesUnified = require(CurrentModule.DiffLines).diffLinesUnified
local diffLinesUnified2 = require(CurrentModule.DiffLines).diffLinesUnified2
local diffStringsRaw = require(CurrentModule.PrintDiffs).diffStringsRaw
local diffStringsUnified = require(CurrentModule.PrintDiffs).diffStringsUnified
local typesModule = require(CurrentModule.types)
export type DiffOptions = typesModule.DiffOptions
export type DiffOptionsColor = typesModule.DiffOptionsColor
local NO_DIFF_MESSAGE = require(CurrentModule.Constants).NO_DIFF_MESSAGE
local SIMILAR_MESSAGE = require(CurrentModule.Constants).SIMILAR_MESSAGE
|
--Sets up touched events for Behaviours
|
function setupTouchedEvents(character)
local parts = character:GetChildren()
for i = 1, #parts do
if parts[i]:isA("BasePart") then
parts[i].Touched:connect(characterTouchedBrick)
end
end
end
function characterAdded(newCharacter)
local humanoid = newCharacter:WaitForChild("Humanoid")
humanoid.WalkSpeed = 0
local splashScreen = player.PlayerGui:WaitForChild("StartScreen")
setupTouchedEvents(newCharacter)
if UserInputService.TouchEnabled == false then
splashScreen.StartInstructions.StartLabel.Text = "Press Space to Start"
end
if reviving == true then
reviving = false
splashScreen:Destroy()
humanoid.WalkSpeed = characterWalkSpeed
end
end
player.CharacterAdded:connect(characterAdded)
function checkReviving(addedGui)
if addedGui.Name == "RevivingGUI" then
reviving = true
end
end
player.PlayerGui.ChildAdded:connect(checkReviving)
if UserInputService.TouchEnabled then
UserInputService.ModalEnabled = true
UserInputService.TouchStarted:connect(function(inputObject, gameProcessedEvent) if gameProcessedEvent == false then doJump = true end end)
UserInputService.TouchEnded:connect(function() doJump = false end)
else
ContextActionService:BindAction("Jump", function(action, userInputState, inputObject) doJump = (userInputState == Enum.UserInputState.Begin) end, false, Enum.KeyCode.Space, Enum.KeyCode.ButtonA)
end
game:GetService("RunService").RenderStepped:connect(function()
if player.Character ~= nil then
if player.Character:FindFirstChild("Humanoid") then
if doJump == true then
jump()
end
player.Character.Humanoid:Move(Vector3.new(0,0,-1), false)
end
end
end)
|
--heroking--
|
local door = script.Parent
local door1 = door.Door1
local door2 = door.Door2
local ret1 = door1.CFrame
local ret2 = door2.CFrame
local spd = script.Parent.Parent.Speed.Value
for i = 1, 58/(15*spd) do
wait()
door1.CFrame = door1.CFrame+spd*door1.CFrame.lookVector
door2.CFrame = door2.CFrame-spd*door1.CFrame.lookVector
end
wait(2)
for i = 1, 58/(15*spd) do
wait()
door1.CFrame = door1.CFrame-spd*door1.CFrame.lookVector
door2.CFrame = door2.CFrame+spd*door1.CFrame.lookVector
end
door2.CFrame = ret2
door1.CFrame = ret1
wait()
script:remove()
|
-- for debuging animations dont delete
|
wait()
local rake = script.Parent.Parent
if rake:FindFirstChild("DebugAnimateSource") and rake:FindFirstChild("AnimateSource") then
if script.Debug.Value == true then
rake.DebugAnimateSource.Disabled = false
rake.AnimateSource:Destroy()
else
rake.DebugAnimateSource:Destroy()
rake.AnimateSource.Disabled = false
end
script:Destroy()
else
script:Destroy()
end
|
-- Note: DotProduct check in CoordinateFrame::lookAt() prevents using values within about
-- 8.11 degrees of the +/- Y axis, that's why these limits are currently 80 degrees
|
local MIN_Y = math.rad(-80)
local MAX_Y = math.rad(80)
local TOUCH_ADJUST_AREA_UP = math.rad(30)
local TOUCH_ADJUST_AREA_DOWN = math.rad(-15)
local TOUCH_SENSITIVTY_ADJUST_MAX_Y = 2.1
local TOUCH_SENSITIVTY_ADJUST_MIN_Y = 0.5
local VR_ANGLE = math.rad(15)
local VR_LOW_INTENSITY_ROTATION = Vector2.new(math.rad(15), 0)
local VR_HIGH_INTENSITY_ROTATION = Vector2.new(math.rad(45), 0)
local VR_LOW_INTENSITY_REPEAT = 0.1
local VR_HIGH_INTENSITY_REPEAT = 0.4
local ZERO_VECTOR2 = Vector2.new(0,0)
local ZERO_VECTOR3 = Vector3.new(0,0,0)
local TOUCH_SENSITIVTY = Vector2.new(0.00945 * math.pi, 0.003375 * math.pi)
local MOUSE_SENSITIVITY = Vector2.new( 0.002 * math.pi, 0.0015 * math.pi )
local SEAT_OFFSET = Vector3.new(0,5,0)
local VR_SEAT_OFFSET = Vector3.new(0,4,0)
local HEAD_OFFSET = Vector3.new(0,1.5,0)
local R15_HEAD_OFFSET = Vector3.new(0, 1.5, 0)
local R15_HEAD_OFFSET_NO_SCALING = Vector3.new(0, 2, 0)
local HUMANOID_ROOT_PART_SIZE = Vector3.new(2, 2, 1)
local GAMEPAD_ZOOM_STEP_1 = 0
local GAMEPAD_ZOOM_STEP_2 = 10
local GAMEPAD_ZOOM_STEP_3 = 20
local PAN_SENSITIVITY = 20
local ZOOM_SENSITIVITY_CURVATURE = 0.5
local abs = math.abs
local sign = math.sign
local FFlagUserCameraToggle do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserCameraToggle")
end)
FFlagUserCameraToggle = success and result
end
local FFlagUserDontAdjustSensitvityForPortrait do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserDontAdjustSensitvityForPortrait")
end)
FFlagUserDontAdjustSensitvityForPortrait = success and result
end
local FFlagUserFixZoomInZoomOutDiscrepancy do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserFixZoomInZoomOutDiscrepancy")
end)
FFlagUserFixZoomInZoomOutDiscrepancy = success and result
end
local Util = require(script.Parent:WaitForChild("CameraUtils"))
local ZoomController = require(script.Parent:WaitForChild("ZoomController"))
local CameraToggleStateController = require(script.Parent:WaitForChild("CameraToggleStateController"))
local CameraInput = require(script.Parent:WaitForChild("CameraInput"))
local CameraUI = require(script.Parent:WaitForChild("CameraUI"))
|
--Variables
|
wait()
local NPC = script.Parent
local Humanoid = NPC:FindFirstChildOfClass("Humanoid")
Humanoid.BreakJointsOnDeath = false
local Anim = script.Animation
local DeathAnimation = Humanoid:LoadAnimation(Anim)
local newNPC = NPC:Clone()
local TweenService = game:GetService("TweenService")
|
--[[
Assert that our expectation value is not nil
]]
|
function Expectation:ok()
local result = (self.value ~= nil) == self.successCondition
local message = formatMessage(self.successCondition,
("Expected value %q to be non-nil"):format(
tostring(self.value)
),
("Expected value %q to be nil"):format(
tostring(self.value)
)
)
assertLevel(result, message, 3)
self:_resetModifiers()
return self
end
|
-- Do not edit these values, they are not the developer-set limits, they are limits
-- to the values the camera system equations can correctly handle
|
local MIN_ALLOWED_ELEVATION_DEG = -80
local MAX_ALLOWED_ELEVATION_DEG = 80
local externalProperties = {}
externalProperties["InitialDistance"] = 25
externalProperties["MinDistance"] = 10
externalProperties["MaxDistance"] = 100
externalProperties["InitialElevation"] = 35
externalProperties["MinElevation"] = 35
externalProperties["MaxElevation"] = 35
externalProperties["ReferenceAzimuth"] = -45 -- Angle around the Y axis where the camera starts. -45 offsets the camera in the -X and +Z directions equally
externalProperties["CWAzimuthTravel"] = 90 -- How many degrees the camera is allowed to rotate from the reference position, CW as seen from above
externalProperties["CCWAzimuthTravel"] = 90 -- How many degrees the camera is allowed to rotate from the reference position, CCW as seen from above
externalProperties["UseAzimuthLimits"] = false -- Full rotation around Y axis available by default
local refAzimuthRad
local curAzimuthRad
local minAzimuthAbsoluteRad
local maxAzimuthAbsoluteRad
local useAzimuthLimits
local curElevationRad
local minElevationRad
local maxElevationRad
local curDistance
local minDistance
local maxDistance
local UNIT_Z = Vector3.new(0,0,1)
local TAU = 2 * math.pi
local changedSignalConnections = {}
|
-- CONSTRUCTORS
|
function Icon.new()
local self = {}
setmetatable(self, Icon)
-- Maids (for autocleanup)
local maid = Maid.new()
self._maid = maid
self._hoveringMaid = maid:give(Maid.new())
self._dropdownClippingMaid = maid:give(Maid.new())
self._menuClippingMaid = maid:give(Maid.new())
-- These are the GuiObjects that make up the icon
local instances = {}
self.instances = instances
local iconContainer = maid:give(iconTemplate:Clone())
iconContainer.Visible = true
iconContainer.Parent = topbarContainer
instances["iconContainer"] = iconContainer
instances["iconButton"] = iconContainer.IconButton
instances["iconImage"] = instances.iconButton.IconImage
instances["iconLabel"] = instances.iconButton.IconLabel
instances["iconGradient"] = instances.iconButton.IconGradient
instances["iconCorner"] = instances.iconButton.IconCorner
instances["iconOverlay"] = iconContainer.IconOverlay
instances["iconOverlayCorner"] = instances.iconOverlay.IconOverlayCorner
instances["noticeFrame"] = instances.iconButton.NoticeFrame
instances["noticeLabel"] = instances.noticeFrame.NoticeLabel
instances["captionContainer"] = iconContainer.CaptionContainer
instances["captionFrame"] = instances.captionContainer.CaptionFrame
instances["captionLabel"] = instances.captionContainer.CaptionLabel
instances["captionCorner"] = instances.captionFrame.CaptionCorner
instances["captionOverlineContainer"] = instances.captionContainer.CaptionOverlineContainer
instances["captionOverline"] = instances.captionOverlineContainer.CaptionOverline
instances["captionOverlineCorner"] = instances.captionOverline.CaptionOverlineCorner
instances["captionVisibilityBlocker"] = instances.captionFrame.CaptionVisibilityBlocker
instances["captionVisibilityCorner"] = instances.captionVisibilityBlocker.CaptionVisibilityCorner
instances["tipFrame"] = iconContainer.TipFrame
instances["tipLabel"] = instances.tipFrame.TipLabel
instances["tipCorner"] = instances.tipFrame.TipCorner
instances["dropdownContainer"] = iconContainer.DropdownContainer
instances["dropdownFrame"] = instances.dropdownContainer.DropdownFrame
instances["dropdownList"] = instances.dropdownFrame.DropdownList
instances["menuContainer"] = iconContainer.MenuContainer
instances["menuFrame"] = instances.menuContainer.MenuFrame
instances["menuList"] = instances.menuFrame.MenuList
instances["clickSound"] = iconContainer.ClickSound
-- These determine and describe how instances behave and appear
self._settings = {
action = {
["toggleTransitionInfo"] = {},
["resizeInfo"] = {},
["repositionInfo"] = {},
["captionFadeInfo"] = {},
["tipFadeInfo"] = {},
["dropdownSlideInfo"] = {},
["menuSlideInfo"] = {},
},
toggleable = {
["iconBackgroundColor"] = {instanceNames = {"iconButton"}, propertyName = "BackgroundColor3"},
["iconBackgroundTransparency"] = {instanceNames = {"iconButton"}, propertyName = "BackgroundTransparency"},
["iconCornerRadius"] = {instanceNames = {"iconCorner", "iconOverlayCorner"}, propertyName = "CornerRadius"},
["iconGradientColor"] = {instanceNames = {"iconGradient"}, propertyName = "Color"},
["iconGradientRotation"] = {instanceNames = {"iconGradient"}, propertyName = "Rotation"},
["iconImage"] = {callMethods = {self._updateIconSize}, instanceNames = {"iconImage"}, propertyName = "Image"},
["iconImageColor"] = {instanceNames = {"iconImage"}, propertyName = "ImageColor3"},
["iconImageTransparency"] = {instanceNames = {"iconImage"}, propertyName = "ImageTransparency"},
["iconScale"] = {instanceNames = {"iconButton"}, propertyName = "Size"},
["forcedIconSizeX"] = {},
["forcedIconSizeY"] = {},
["iconSize"] = {callSignals = {self.updated}, callMethods = {self._updateIconSize}, instanceNames = {"iconContainer"}, propertyName = "Size", tweenAction = "resizeInfo"},
["iconOffset"] = {instanceNames = {"iconButton"}, propertyName = "Position"},
["iconText"] = {callMethods = {self._updateIconSize}, instanceNames = {"iconLabel"}, propertyName = "Text"},
["iconTextColor"] = {instanceNames = {"iconLabel"}, propertyName = "TextColor3"},
["iconFont"] = {callMethods = {self._updateIconSize}, instanceNames = {"iconLabel"}, propertyName = "Font"},
["iconImageYScale"] = {callMethods = {self._updateIconSize}},
["iconImageRatio"] = {callMethods = {self._updateIconSize}},
["iconLabelYScale"] = {callMethods = {self._updateIconSize}},
["noticeCircleColor"] = {instanceNames = {"noticeFrame"}, propertyName = "ImageColor3"},
["noticeCircleImage"] = {instanceNames = {"noticeFrame"}, propertyName = "Image"},
["noticeTextColor"] = {instanceNames = {"noticeLabel"}, propertyName = "TextColor3"},
["noticeImageTransparency"] = {instanceNames = {"noticeFrame"}, propertyName = "ImageTransparency"},
["noticeTextTransparency"] = {instanceNames = {"noticeLabel"}, propertyName = "TextTransparency"},
["baseZIndex"] = {callMethods = {self._updateBaseZIndex}},
["order"] = {callSignals = {self.updated}, instanceNames = {"iconContainer"}, propertyName = "LayoutOrder"},
["alignment"] = {callSignals = {self.updated}, callMethods = {self._updateDropdown}},
["iconImageVisible"] = {instanceNames = {"iconImage"}, propertyName = "Visible"},
["iconImageAnchorPoint"] = {instanceNames = {"iconImage"}, propertyName = "AnchorPoint"},
["iconImagePosition"] = {instanceNames = {"iconImage"}, propertyName = "Position", tweenAction = "resizeInfo"},
["iconImageSize"] = {instanceNames = {"iconImage"}, propertyName = "Size", tweenAction = "resizeInfo"},
["iconImageTextXAlignment"] = {instanceNames = {"iconImage"}, propertyName = "TextXAlignment"},
["iconLabelVisible"] = {instanceNames = {"iconLabel"}, propertyName = "Visible"},
["iconLabelAnchorPoint"] = {instanceNames = {"iconLabel"}, propertyName = "AnchorPoint"},
["iconLabelPosition"] = {instanceNames = {"iconLabel"}, propertyName = "Position", tweenAction = "resizeInfo"},
["iconLabelSize"] = {instanceNames = {"iconLabel"}, propertyName = "Size", tweenAction = "resizeInfo"},
["iconLabelTextXAlignment"] = {instanceNames = {"iconLabel"}, propertyName = "TextXAlignment"},
["iconLabelTextSize"] = {instanceNames = {"iconLabel"}, propertyName = "TextSize"},
["noticeFramePosition"] = {instanceNames = {"noticeFrame"}, propertyName = "Position"},
["clickSoundId"] = {instanceNames = {"clickSound"}, propertyName = "SoundId"},
["clickVolume"] = {instanceNames = {"clickSound"}, propertyName = "Volume"},
["clickPlaybackSpeed"] = {instanceNames = {"clickSound"}, propertyName = "PlaybackSpeed"},
["clickTimePosition"] = {instanceNames = {"clickSound"}, propertyName = "TimePosition"},
},
other = {
["captionBackgroundColor"] = {instanceNames = {"captionFrame"}, propertyName = "BackgroundColor3"},
["captionBackgroundTransparency"] = {instanceNames = {"captionFrame"}, propertyName = "BackgroundTransparency", group = "caption"},
["captionBlockerTransparency"] = {instanceNames = {"captionVisibilityBlocker"}, propertyName = "BackgroundTransparency", group = "caption"},
["captionOverlineColor"] = {instanceNames = {"captionOverline"}, propertyName = "BackgroundColor3"},
["captionOverlineTransparency"] = {instanceNames = {"captionOverline"}, propertyName = "BackgroundTransparency", group = "caption"},
["captionTextColor"] = {instanceNames = {"captionLabel"}, propertyName = "TextColor3"},
["captionTextTransparency"] = {instanceNames = {"captionLabel"}, propertyName = "TextTransparency", group = "caption"},
["captionFont"] = {instanceNames = {"captionLabel"}, propertyName = "Font"},
["captionCornerRadius"] = {instanceNames = {"captionCorner", "captionOverlineCorner", "captionVisibilityCorner"}, propertyName = "CornerRadius"},
["tipBackgroundColor"] = {instanceNames = {"tipFrame"}, propertyName = "BackgroundColor3"},
["tipBackgroundTransparency"] = {instanceNames = {"tipFrame"}, propertyName = "BackgroundTransparency", group = "tip"},
["tipTextColor"] = {instanceNames = {"tipLabel"}, propertyName = "TextColor3"},
["tipTextTransparency"] = {instanceNames = {"tipLabel"}, propertyName = "TextTransparency", group = "tip"},
["tipFont"] = {instanceNames = {"tipLabel"}, propertyName = "Font"},
["tipCornerRadius"] = {instanceNames = {"tipCorner"}, propertyName = "CornerRadius"},
["dropdownSize"] = {instanceNames = {"dropdownContainer"}, propertyName = "Size", unique = "dropdown"},
["dropdownCanvasSize"] = {instanceNames = {"dropdownFrame"}, propertyName = "CanvasSize"},
["dropdownMaxIconsBeforeScroll"] = {callMethods = {self._updateDropdown}},
["dropdownMinWidth"] = {callMethods = {self._updateDropdown}},
["dropdownSquareCorners"] = {callMethods = {self._updateDropdown}},
["dropdownBindToggleToIcon"] = {},
["dropdownToggleOnLongPress"] = {},
["dropdownToggleOnRightClick"] = {},
["dropdownCloseOnTapAway"] = {},
["dropdownHidePlayerlistOnOverlap"] = {},
["dropdownListPadding"] = {callMethods = {self._updateDropdown}, instanceNames = {"dropdownList"}, propertyName = "Padding"},
["dropdownAlignment"] = {callMethods = {self._updateDropdown}},
["dropdownScrollBarColor"] = {instanceNames = {"dropdownFrame"}, propertyName = "ScrollBarImageColor3"},
["dropdownScrollBarTransparency"] = {instanceNames = {"dropdownFrame"}, propertyName = "ScrollBarImageTransparency"},
["dropdownScrollBarThickness"] = {instanceNames = {"dropdownFrame"}, propertyName = "ScrollBarThickness"},
["dropdownIgnoreClipping"] = {callMethods = {self._dropdownIgnoreClipping}},
["menuSize"] = {instanceNames = {"menuContainer"}, propertyName = "Size", unique = "menu"},
["menuCanvasSize"] = {instanceNames = {"menuFrame"}, propertyName = "CanvasSize"},
["menuMaxIconsBeforeScroll"] = {callMethods = {self._updateMenu}},
["menuBindToggleToIcon"] = {},
["menuToggleOnLongPress"] = {},
["menuToggleOnRightClick"] = {},
["menuCloseOnTapAway"] = {},
["menuListPadding"] = {callMethods = {self._updateMenu}, instanceNames = {"menuList"}, propertyName = "Padding"},
["menuDirection"] = {callMethods = {self._updateMenu}},
["menuScrollBarColor"] = {instanceNames = {"menuFrame"}, propertyName = "ScrollBarImageColor3"},
["menuScrollBarTransparency"] = {instanceNames = {"menuFrame"}, propertyName = "ScrollBarImageTransparency"},
["menuScrollBarThickness"] = {instanceNames = {"menuFrame"}, propertyName = "ScrollBarThickness"},
["menuIgnoreClipping"] = {callMethods = {self._menuIgnoreClipping}},
}
}
---------------------------------
self._groupSettings = {}
for _, settingsDetails in pairs(self._settings) do
for settingName, settingDetail in pairs(settingsDetails) do
local group = settingDetail.group
if group then
local groupSettings = self._groupSettings[group]
if not groupSettings then
groupSettings = {}
self._groupSettings[group] = groupSettings
end
table.insert(groupSettings, settingName)
settingDetail.forcedGroupValue = DEFAULT_FORCED_GROUP_VALUES[group]
settingDetail.useForcedGroupValue = true
end
end
end
---------------------------------
-- The setting values themselves will be set within _settings
-- Setup a dictionary to make it quick and easy to reference setting by name
self._settingsDictionary = {}
-- Some instances require unique behaviours. These are defined with the 'unique' key
-- for instance, we only want caption transparency effects to be applied on hovering
self._uniqueSettings = {}
self._uniqueSettingsDictionary = {}
self.uniqueValues = {}
local uniqueBehaviours = {
["dropdown"] = function(settingName, instance, propertyName, value)
local tweenInfo = self:get("dropdownSlideInfo")
local bindToggleToIcon = self:get("dropdownBindToggleToIcon")
local hidePlayerlist = self:get("dropdownHidePlayerlistOnOverlap") == true and self:get("alignment") == "right"
local dropdownContainer = self.instances.dropdownContainer
local dropdownFrame = self.instances.dropdownFrame
local newValue = value
local isOpen = true
local isDeselected = not self.isSelected
if bindToggleToIcon == false then
isDeselected = not self.dropdownOpen
end
local isSpecialPressing = self._longPressing or self._rightClicking
if self._tappingAway or (isDeselected and not isSpecialPressing) or (isSpecialPressing and self.dropdownOpen) then
local dropdownSize = self:get("dropdownSize")
local XOffset = (dropdownSize and dropdownSize.X.Offset/1) or 0
newValue = UDim2.new(0, XOffset, 0, 0)
isOpen = false
end
-- if #self.dropdownIcons > 0 and isOpen and hidePlayerlist and self._parentIcon == nil and self._bringBackPlayerlist == nil then
if #self.dropdownIcons > 0 and isOpen and hidePlayerlist then
if starterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList) then
IconController._bringBackPlayerlist = (IconController._bringBackPlayerlist and IconController._bringBackPlayerlist + 1) or 1
self._bringBackPlayerlist = true
starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
end
elseif self._bringBackPlayerlist and not isOpen and IconController._bringBackPlayerlist then
IconController._bringBackPlayerlist -= 1
if IconController._bringBackPlayerlist <= 0 then
IconController._bringBackPlayerlist = nil
starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
end
self._bringBackPlayerlist = nil
end
local tween = tweenService:Create(instance, tweenInfo, {[propertyName] = newValue})
local connection
connection = tween.Completed:Connect(function()
connection:Disconnect()
--dropdownContainer.ClipsDescendants = not self.dropdownOpen
end)
tween:Play()
if isOpen then
--dropdownFrame.CanvasPosition = self._dropdownCanvasPos
else
self._dropdownCanvasPos = dropdownFrame.CanvasPosition
end
dropdownFrame.ScrollingEnabled = isOpen -- It's important scrolling is only enabled when the dropdown is visible otherwise it could block the scrolling behaviour of other icons
self.dropdownOpen = isOpen
self:_decideToCallSignal("dropdown")
end,
["menu"] = function(settingName, instance, propertyName, value)
local tweenInfo = self:get("menuSlideInfo")
local bindToggleToIcon = self:get("menuBindToggleToIcon")
local menuContainer = self.instances.menuContainer
local menuFrame = self.instances.menuFrame
local newValue = value
local isOpen = true
local isDeselected = not self.isSelected
if bindToggleToIcon == false then
isDeselected = not self.menuOpen
end
local isSpecialPressing = self._longPressing or self._rightClicking
if self._tappingAway or (isDeselected and not isSpecialPressing) or (isSpecialPressing and self.menuOpen) then
local menuSize = self:get("menuSize")
local YOffset = (menuSize and menuSize.Y.Offset/1) or 0
newValue = UDim2.new(0, 0, 0, YOffset)
isOpen = false
end
if isOpen ~= self.menuOpen then
self.updated:Fire()
end
if isOpen and tweenInfo.EasingDirection == Enum.EasingDirection.Out then
tweenInfo = TweenInfo.new(tweenInfo.Time, tweenInfo.EasingStyle, Enum.EasingDirection.In)
end
local tween = tweenService:Create(instance, tweenInfo, {[propertyName] = newValue})
local connection
connection = tween.Completed:Connect(function()
connection:Disconnect()
--menuContainer.ClipsDescendants = not self.menuOpen
end)
tween:Play()
if isOpen then
if self._menuCanvasPos then
menuFrame.CanvasPosition = self._menuCanvasPos
end
else
self._menuCanvasPos = menuFrame.CanvasPosition
end
menuFrame.ScrollingEnabled = isOpen -- It's important scrolling is only enabled when the menu is visible otherwise it could block the scrolling behaviour of other icons
self.menuOpen = isOpen
self:_decideToCallSignal("menu")
end,
}
for settingsType, settingsDetails in pairs(self._settings) do
for settingName, settingDetail in pairs(settingsDetails) do
if settingsType == "toggleable" then
settingDetail.values = settingDetail.values or {
deselected = nil,
selected = nil,
}
else
settingDetail.value = nil
end
settingDetail.additionalValues = {}
settingDetail.type = settingsType
self._settingsDictionary[settingName] = settingDetail
--
local uniqueCat = settingDetail.unique
if uniqueCat then
local uniqueCatArray = self._uniqueSettings[uniqueCat] or {}
table.insert(uniqueCatArray, settingName)
self._uniqueSettings[uniqueCat] = uniqueCatArray
self._uniqueSettingsDictionary[settingName] = uniqueBehaviours[uniqueCat]
end
--
end
end
-- Signals (events)
self.updated = maid:give(Signal.new())
self.selected = maid:give(Signal.new())
self.deselected = maid:give(Signal.new())
self.toggled = maid:give(Signal.new())
self.userSelected = maid:give(Signal.new())
self.userDeselected = maid:give(Signal.new())
self.userToggled = maid:give(Signal.new())
self.hoverStarted = maid:give(Signal.new())
self.hoverEnded = maid:give(Signal.new())
self.dropdownOpened = maid:give(Signal.new())
self.dropdownClosed = maid:give(Signal.new())
self.menuOpened = maid:give(Signal.new())
self.menuClosed = maid:give(Signal.new())
self.notified = maid:give(Signal.new())
self._endNotices = maid:give(Signal.new())
self._ignoreClippingChanged = maid:give(Signal.new())
-- Connections
-- This enables us to chain icons and features like menus and dropdowns together without them being hidden by parent frame with ClipsDescendants enabled
local function setFeatureChange(featureName, value)
local parentIcon = self._parentIcon
self:set(featureName.."IgnoreClipping", value)
if value == true and parentIcon then
local connection = parentIcon._ignoreClippingChanged:Connect(function(_, value)
self:set(featureName.."IgnoreClipping", value)
end)
local endConnection
endConnection = self[featureName.."Closed"]:Connect(function()
endConnection:Disconnect()
connection:Disconnect()
end)
end
end
self.dropdownOpened:Connect(function()
setFeatureChange("dropdown", true)
end)
self.dropdownClosed:Connect(function()
setFeatureChange("dropdown", false)
end)
self.menuOpened:Connect(function()
setFeatureChange("menu", true)
end)
self.menuClosed:Connect(function()
setFeatureChange("menu", false)
end)
--]]
-- Properties
self.deselectWhenOtherIconSelected = true
self.name = ""
self.isSelected = false
self.presentOnTopbar = true
self.accountForWhenDisabled = false
self.enabled = true
self.hovering = false
self.tipText = nil
self.captionText = nil
self.totalNotices = 0
self.notices = {}
self.dropdownIcons = {}
self.menuIcons = {}
self.dropdownOpen = false
self.menuOpen = false
self.locked = false
self.topPadding = UDim.new(0, 4)
self.targetPosition = nil
self.toggleItems = {}
self.lockedSettings = {}
self.UID = httpService:GenerateGUID(true)
self.blockBackBehaviourChecks = {}
-- Private Properties
self._draggingFinger = false
self._updatingIconSize = true
self._previousDropdownOpen = false
self._previousMenuOpen = false
self._bindedToggleKeys = {}
self._bindedEvents = {}
-- Apply start values
self:setName("UnnamedIcon")
self:setTheme(DEFAULT_THEME, true)
-- Input handlers
-- Calls deselect/select when the icon is clicked
--[[instances.iconButton.MouseButton1Click:Connect(function()
if self.locked then return end
if self._draggingFinger then
return false
elseif self.isSelected then
self:deselect()
return true
end
self:select()
end)--]]
instances.iconButton.MouseButton1Click:Connect(function()
if self.locked then return end
if self.isSelected then
self:deselect()
self.userDeselected:Fire()
self.userToggled:Fire(false)
return true
end
self:select()
self.userSelected:Fire()
self.userToggled:Fire(true)
end)
instances.iconButton.MouseButton2Click:Connect(function()
self._rightClicking = true
if self:get("dropdownToggleOnRightClick") == true then
self:_update("dropdownSize")
end
if self:get("menuToggleOnRightClick") == true then
self:_update("menuSize")
end
self._rightClicking = false
end)
-- Shows/hides the dark overlay when the icon is presssed/released
instances.iconButton.MouseButton1Down:Connect(function()
if self.locked then return end
self:_updateStateOverlay(0.7, Color3.new(0, 0, 0))
end)
instances.iconButton.MouseButton1Up:Connect(function()
if self.overlayLocked then return end
self:_updateStateOverlay(0.9, Color3.new(1, 1, 1))
end)
-- Tap away + KeyCode toggles
userInputService.InputBegan:Connect(function(input, touchingAnObject)
local validTapAwayInputs = {
[Enum.UserInputType.MouseButton1] = true,
[Enum.UserInputType.MouseButton2] = true,
[Enum.UserInputType.MouseButton3] = true,
[Enum.UserInputType.Touch] = true,
}
if not touchingAnObject and validTapAwayInputs[input.UserInputType] then
self._tappingAway = true
if self.dropdownOpen and self:get("dropdownCloseOnTapAway") == true then
self:_update("dropdownSize")
end
if self.menuOpen and self:get("menuCloseOnTapAway") == true then
self:_update("menuSize")
end
self._tappingAway = false
end
--
if self._bindedToggleKeys[input.KeyCode] and not touchingAnObject and not self.locked then
if self.isSelected then
self:deselect()
self.userDeselected:Fire()
self.userToggled:Fire(false)
else
self:select()
self.userSelected:Fire()
self.userToggled:Fire(true)
end
end
--
end)
-- hoverStarted and hoverEnded triggers and actions
-- these are triggered when a mouse enters/leaves the icon with a mouse, is highlighted with
-- a controller selection box, or dragged over with a touchpad
self.hoverStarted:Connect(function(x, y)
self.hovering = true
if not self.locked then
self:_updateStateOverlay(0.9, Color3.fromRGB(255, 255, 255))
end
self:_updateHovering()
end)
self.hoverEnded:Connect(function()
self.hovering = false
self:_updateStateOverlay(1)
self._hoveringMaid:clean()
self:_updateHovering()
end)
instances.iconButton.MouseEnter:Connect(function(x, y) -- Mouse (started)
self.hoverStarted:Fire(x, y)
end)
instances.iconButton.MouseLeave:Connect(function() -- Mouse (ended)
self.hoverEnded:Fire()
end)
instances.iconButton.SelectionGained:Connect(function() -- Controller (started)
self.hoverStarted:Fire()
end)
instances.iconButton.SelectionLost:Connect(function() -- Controller (ended)
self.hoverEnded:Fire()
end)
instances.iconButton.MouseButton1Down:Connect(function() -- TouchPad (started)
if self._draggingFinger then
self.hoverStarted:Fire()
end
-- Long press check
local heartbeatConnection
local releaseConnection
local longPressTime = 0.7
local endTick = tick() + longPressTime
heartbeatConnection = runService.Heartbeat:Connect(function()
if tick() >= endTick then
releaseConnection:Disconnect()
heartbeatConnection:Disconnect()
self._longPressing = true
if self:get("dropdownToggleOnLongPress") == true then
self:_update("dropdownSize")
end
if self:get("menuToggleOnLongPress") == true then
self:_update("menuSize")
end
self._longPressing = false
end
end)
releaseConnection = instances.iconButton.MouseButton1Up:Connect(function()
releaseConnection:Disconnect()
heartbeatConnection:Disconnect()
end)
end)
if userInputService.TouchEnabled then
instances.iconButton.MouseButton1Up:Connect(function() -- TouchPad (ended), this was originally enabled for non-touchpads too
if self.hovering then
self.hoverEnded:Fire()
end
end)
-- This is used to highlight when a mobile/touch device is dragging their finger accross the screen
-- this is important for determining the hoverStarted and hoverEnded events on mobile
local dragCount = 0
userInputService.TouchMoved:Connect(function(touch, touchingAnObject)
if touchingAnObject then
return
end
self._draggingFinger = true
end)
userInputService.TouchEnded:Connect(function()
self._draggingFinger = false
end)
end
-- Finish
self._updatingIconSize = false
self:_updateIconSize()
IconController.iconAdded:Fire(self)
return self
end
|
--[[Transmission]]
|
Tune.TransModes = {"Auto", "Semi", "Manual"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[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 = 3 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.53 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.04 ,
--[[ 3 ]] 1.38 ,
--[[ 4 ]] 1.03 ,
--[[ 5 ]] 0.81 ,
--[[ 6 ]] 0.64 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--// [[ INTRO PLAY HOVER ]] \\--
|
IntroGui.ButtonFrame.PlayButton.MouseEnter:Connect(function()
IntroGui.ButtonFrame.PlayButton.GreenDot.Visible = true
end)
IntroGui.ButtonFrame.PlayButton.MouseLeave:Connect(function()
IntroGui.ButtonFrame.PlayButton.GreenDot.Visible = false
end)
|
--[[Susupension]]
|
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 400 -- Spring Dampening
Tune.FSusStiffness = 17000 -- Spring Force
Tune.FSusLength = 1.9 -- Resting Suspension length (in studs)
Tune.FSusMaxExt = .15 -- Max Extension Travel (in studs)
Tune.FSusMaxComp = .05 -- Max Compression Travel (in studs)
Tune.FSusAngle = 75 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 6 -- Wishbone Length
Tune.FWsBoneAngle = 3 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 400 -- Spring Dampening
Tune.RSusStiffness = 17000 -- Spring Force
Tune.RSusLength = 2.1 -- Resting Suspension length (in studs)
Tune.RSusMaxExt = .15 -- Max Extension Travel (in studs)
Tune.RSusMaxComp = .05 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 2 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = false -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Bronze" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 8 -- Suspension Coil Count
Tune.WsColor = "White" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
--[[Drivetrain]]
|
Tune.Config = "RWD" --"FWD" , "RWD" , "AWD"
Tune.TorqueVector = 0.5 --AWD ONLY, "-1" has a 100% front bias, "0" has a 50:50 bias, and "1" has a 100% rear bias. Can be any number between that range.
--Differential Settings
Tune.FDiffSlipThres = 50 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 50 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 80 -- 1 - 100%
Tune.RDiffLockThres = 20 -- 0 - 100%
Tune.CDiffSlipThres = 50 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 50 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = true -- Implements TCS
Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
|
-- Roact
|
local new = Roact.createElement
local Frame = require(UI:WaitForChild 'Frame')
local ImageLabel = require(UI:WaitForChild 'ImageLabel')
local ImageButton = require(UI:WaitForChild 'ImageButton')
local TextLabel = require(UI:WaitForChild 'TextLabel')
local ItemList = require(script:WaitForChild 'ItemList')
|
----------------------
|
for i,plr in pairs(game.Players:GetPlayers()) do
repeat
local userData = storage.LoadData(plr.UserId)
wait(0.5)
if not userData then end
until userData == true
end
|
--// bolekinds
|
local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
script.Parent.MouseButton1Click:Connect(function()
if plr.YouCash.Value >= 110 and game.ServerStorage.ServerData.contract.Value == false then
script.Parent.Parent.Parent.Ching:Play()
plr.YouCash.Value -= 110
game.ServerStorage.ServerData.contract.Value = true
end
end)
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local methods = {}
methods.__index = methods
function ReturnToObjectPoolRecursive(instance, objectPool)
local children = instance:GetChildren()
for i = 1, #children do
ReturnToObjectPoolRecursive(children[i], objectPool)
end
instance.Parent = nil
objectPool:ReturnInstance(instance)
end
function GetMessageCreators()
local typeToFunction = {}
local creators = messageCreatorModules:GetChildren()
for i = 1, #creators do
if creators[i]:IsA("ModuleScript") then
if creators[i].Name ~= "Util" then
local creator = require(creators[i])
typeToFunction[creator[messageCreatorUtil.KEY_MESSAGE_TYPE]] = creator[messageCreatorUtil.KEY_CREATOR_FUNCTION]
end
end
end
return typeToFunction
end
function methods:WrapIntoMessageObject(messageData, createdMessageObject)
local BaseFrame = createdMessageObject[messageCreatorUtil.KEY_BASE_FRAME]
local BaseMessage = nil
if messageCreatorUtil.KEY_BASE_MESSAGE then
BaseMessage = createdMessageObject[messageCreatorUtil.KEY_BASE_MESSAGE]
end
local UpdateTextFunction = createdMessageObject[messageCreatorUtil.KEY_UPDATE_TEXT_FUNC]
local GetHeightFunction = createdMessageObject[messageCreatorUtil.KEY_GET_HEIGHT]
local FadeInFunction = createdMessageObject[messageCreatorUtil.KEY_FADE_IN]
local FadeOutFunction = createdMessageObject[messageCreatorUtil.KEY_FADE_OUT]
local UpdateAnimFunction = createdMessageObject[messageCreatorUtil.KEY_UPDATE_ANIMATION]
local obj = {}
obj.ID = messageData.ID
obj.BaseFrame = BaseFrame
obj.BaseMessage = BaseMessage
obj.UpdateTextFunction = UpdateTextFunction or function() warn("NO MESSAGE RESIZE FUNCTION") end
obj.GetHeightFunction = GetHeightFunction
obj.FadeInFunction = FadeInFunction
obj.FadeOutFunction = FadeOutFunction
obj.UpdateAnimFunction = UpdateAnimFunction
obj.ObjectPool = self.ObjectPool
obj.Destroyed = false
function obj:Destroy()
ReturnToObjectPoolRecursive(self.BaseFrame, self.ObjectPool)
self.Destroyed = true
end
return obj
end
function methods:CreateMessageLabel(messageData, currentChannelName)
local messageType = messageData.MessageType
if self.MessageCreators[messageType] then
local createdMessageObject = self.MessageCreators[messageType](messageData, currentChannelName)
if createdMessageObject then
return self:WrapIntoMessageObject(messageData, createdMessageObject)
end
elseif self.DefaultCreatorType then
local createdMessageObject = self.MessageCreators[self.DefaultCreatorType](messageData, currentChannelName)
if createdMessageObject then
return self:WrapIntoMessageObject(messageData, createdMessageObject)
end
else
error("No message creator available for message type: " ..messageType)
end
end
|
--[=[
Clones a brio, such that it may be killed without affecting the original
brio.
@param brio Brio<T>
@return Brio<T>
]=]
|
function BrioUtils.clone(brio)
assert(brio, "Bad brio")
if brio:IsDead() then
return Brio.DEAD
end
local newBrio = Brio.new(brio:GetValue())
newBrio:ToMaid():GiveTask(brio:GetDiedSignal():Connect(function()
newBrio:Kill()
end))
return newBrio
end
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================
|
local function getCheckpointFromPart(part)
for _, checkpoint in pairs(checkpoints) do
if checkpoint.CollisionBody == part then
return checkpoint
end
end
return nil
end -- getCheckpointFromPart()
local function hasPlayerFinishedLap(player, lap)
for _, checkpoint in pairs(checkpoints) do
if checkpoint:PlayerLapPassed(player, lap) ~= lap then
return false
end
end
return true
end -- hasPlayerFinishedLap()
local function addRacer(player)
racers[player] = Racer.new()
end -- addRacer()
local function checkAllFinished()
for _, racer in pairs(racers) do
if not racer:HasFinishedLap(numLaps) then
return false
end
end
return true
end -- checkAllFinished()
|
-- Functions --
|
local function playSoundLocal(sId,sParent)
local sound = Instance.new("Sound",sParent)
sound.SoundId = "rbxassetid://"..sId
sound:Play()
sound:Destroy()
end
local function onClicked(player)
playSoundLocal(152206246,player) -- Declaring the sound ID and Parent
local foundShirt = player.Character:FindFirstChild("Shirt") -- Tries to find Shirt
if not foundShirt then -- if there is no shirt
local newShirt = Instance.new("Shirt",player.Character)
newShirt.Name = "Shirt"
else if foundShirt then -- if there is a shirt
player.Character.Shirt:remove()
local newShirt = Instance.new("Shirt",player.Character)
newShirt.Name = "Shirt"
end
end
local foundPants = player.Character:FindFirstChild("Pants") -- Tries to find Pants
if not foundPants then -- if there are no pants
local newPants = Instance.new("Pants",player.Character)
newPants.Name = "Pants"
else if foundPants then -- if there are pants
player.Character.Pants:remove()
local newPants = Instance.new("Pants",player.Character)
newPants.Name = "Pants"
end
end
player.Character.Shirt.ShirtTemplate = shirtId
player.Character.Pants.PantsTemplate = pantsId
end
local function onHoverEnter(player)
cPart.BrickColor = BrickColor.White()
end
local function onHoverLeave(player)
cPart.BrickColor = BrickColor.Gray()
end
|
--[[[Default Controls]]
|
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 3 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 3 , -- Controller steering R-deadzone (0 - 100%)
}
Tune.KickdownWindow = .25 --Time (seconds) in which you must double click throttle key
Tune.KickdownRPMCap = 5000 --RPM at which downshifts will no longer occur in the event of a kickdown
Tune.LaunchBuildup = 2500 --RPM in which launch control will build up to
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.Y ,
ToggleTransMode = Enum.KeyCode.M ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.P ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.DPadUp ,
ContlrToggleTCS = Enum.KeyCode.ButtonA ,
ContlrToggleABS = Enum.KeyCode.ButtonA ,
}
|
--[=[
Similar to [Promise.andThen](#andThen), except the return value is the same as the value passed to the handler. In other words, you can insert a `:tap` into a Promise chain without affecting the value that downstream Promises receive.
```lua
getTheValue()
:tap(print)
:andThen(function(theValue)
print("Got", theValue, "even though print returns nil!")
end)
```
If you return a Promise from the tap handler callback, its value will be discarded but `tap` will still wait until it resolves before passing the original value through.
@param tapHandler (...: any) -> ...any
@return Promise<...any>
]=]
|
function Promise.prototype:tap(tapHandler)
assert(isCallable(tapHandler), string.format(ERROR_NON_FUNCTION, "Promise:tap"))
return self:_andThen(debug.traceback(nil, 2), function(...)
local callbackReturn = tapHandler(...)
if Promise.is(callbackReturn) then
local length, values = pack(...)
return callbackReturn:andThen(function()
return unpack(values, 1, length)
end)
end
return ...
end)
end
|
--s.Pitch = 0.7
--s.Pitch = 0.7
|
while true do
while s.Pitch<1.1 do
s.Pitch=s.Pitch+0.012
s:Play()
if s.Pitch>1.1 then
s.Pitch=1.1
end
wait(0.001)
end
|
--[[~-Fixico-~]]
|
--
print("Fixico's Scripts")
local isOn = true
function on()
isOn = true
script.Parent.Transparency = 0
script.Parent.CanCollide = true
end
function off()
isOn = false
script.Parent.Transparency = .5
script.Parent.CanCollide = false
end
function onClicked()
if isOn == true then off() else on() end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
on()
|
-- v.Changed:Connect(function(prop)
-- v2[prop] = v[prop]
-- end)
|
end
script.Parent.CurrentCamera = cam
cam.CFrame = workspace.NPCS:WaitForChild("NPC").HumanoidRootPart.CFrame * CFrame.new(0,3,-4) * CFrame.Angles(math.rad(30),math.rad(180),0)
end)
|
-- Auto saving and issue queue managing:
|
RunService.Heartbeat:Connect(function()
-- 1) Auto saving: --
local auto_save_list_length = #AutoSaveList
if auto_save_list_length > 0 then
local auto_save_index_speed = SETTINGS.AutoSaveProfiles / auto_save_list_length
local os_clock = os.clock()
while os_clock - LastAutoSave > auto_save_index_speed do
LastAutoSave = LastAutoSave + auto_save_index_speed
local profile = AutoSaveList[AutoSaveIndex]
if os_clock - profile._load_timestamp < SETTINGS.AutoSaveProfiles then
-- This profile is freshly loaded - auto-saving immediately after loading will cause a warning in the log:
profile = nil
for _ = 1, auto_save_list_length - 1 do
-- Move auto save index to the right:
AutoSaveIndex = AutoSaveIndex + 1
if AutoSaveIndex > auto_save_list_length then
AutoSaveIndex = 1
end
profile = AutoSaveList[AutoSaveIndex]
if os_clock - profile._load_timestamp >= SETTINGS.AutoSaveProfiles then
break
else
profile = nil
end
end
end
-- Move auto save index to the right:
AutoSaveIndex = AutoSaveIndex + 1
if AutoSaveIndex > auto_save_list_length then
AutoSaveIndex = 1
end
-- Perform save call:
if profile ~= nil then
coroutine.wrap(SaveProfileAsync)(profile) -- Auto save profile in new thread
end
end
end
-- 2) Issue queue: --
-- Critical state handling:
if ProfileService.CriticalState == false then
if #IssueQueue >= SETTINGS.IssueCountForCriticalState then
ProfileService.CriticalState = true
ProfileService.CriticalStateSignal:Fire(true)
CriticalStateStart = os.clock()
warn("[ProfileService]: Entered critical state")
end
else
if #IssueQueue >= SETTINGS.IssueCountForCriticalState then
CriticalStateStart = os.clock()
elseif os.clock() - CriticalStateStart > SETTINGS.CriticalStateLast then
ProfileService.CriticalState = false
ProfileService.CriticalStateSignal:Fire(false)
warn("[ProfileService]: Critical state ended")
end
end
-- Issue queue:
while true do
local issue_time = IssueQueue[1]
if issue_time == nil then
break
elseif os.clock() - issue_time > SETTINGS.IssueLast then
table.remove(IssueQueue, 1)
else
break
end
end
end)
|
--print(script.Parent.F1.Position)
|
wait(timer)
script.Parent.F2:TweenSize(UDim2.new(15, 0,0.1, 0))
wait(timer)
script.Parent.F3:TweenSize(UDim2.new(15, 0,0.1, 0))
wait(timer)
script.Parent.F4:TweenSize(UDim2.new(15, 0,0.1, 0))
wait(timer)
script.Parent.F5:TweenSize(UDim2.new(15, 0,0.1, 0))
wait(timer)
script.Parent.F6:TweenSize(UDim2.new(15, 0,0.1, 0))
wait(timer)
script.Parent.F7:TweenSize(UDim2.new(15, 0,0.1, 0))
wait(timer)
script.Parent.F8:TweenSize(UDim2.new(15, 0,0.1, 0))
wait(timer)
script.Parent.F9:TweenSize(UDim2.new(15, 0,0.1, 0))
wait(timer)
script.Parent.F99:TweenSize(UDim2.new(15, 0,0.1, 0))
for i = respawntime, 0, -1 do
wait(1)
if i == 0 then
script.Parent.F1:TweenSize(UDim2.new(0, 0,0.1, 0)) wait(timer2)
script.Parent.F2:TweenSize(UDim2.new(0, 0,0.1, 0)) wait(timer2)
script.Parent.F3:TweenSize(UDim2.new(0, 0,0.1, 0)) wait(timer2)
script.Parent.F4:TweenSize(UDim2.new(0, 0,0.1, 0)) wait(timer2)
script.Parent.F5:TweenSize(UDim2.new(0, 0,0.1, 0)) wait(timer2)
script.Parent.F6:TweenSize(UDim2.new(0, 0,0.1, 0)) wait(timer2)
script.Parent.F7:TweenSize(UDim2.new(0, 0,0.1, 0)) wait(timer2)
script.Parent.F8:TweenSize(UDim2.new(0, 0,0.1, 0)) wait(timer2)
script.Parent.F9:TweenSize(UDim2.new(0, 0,0.1, 0)) wait(timer2)
script.Parent.F99:TweenSize(UDim2.new(0, 0,0.1, 0)) wait(timer2)
wait()
end
end
wait(1)
script.Parent.Parent:Destroy()
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Magenta",Paint)
end)
|
--Main Chat Script
|
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player, msg, rec, send)
local filter = game:GetService("Chat"):FilterStringForBroadcast(msg, player)
game.ReplicatedStorage.RemoteEvent:FireAllClients(filter, rec, send)
end)
|
--MISC
-- FUNCTIONS
---- smallestAxis()
----- Gets the smallest axis of the Part using
----- nested math.min's.
---- largestAxis()
----- Gets the largest axis of the Part using
----- nested math.max's.
---- modulusWait(i, interval)
----- If the modulus (remainder) of interval
----- after i is 0, then the function wait()s
----- This is used in removing parts, placing
----- stars, and placing connecting lines for
----- simultaneously performance and effect.
| |
----//Variables//
|
local CurrentCamera = workspace.CurrentCamera
local Plr = game.Players.LocalPlayer
|
--!strict
--EntityComponent
--Yuuwa0519
--2022-03-16
| |
-- Bot Open
|
MainDoor.Touched:Connect(function(hit)
if Door.OpenClosed.Value == "Closed" and DoorReady.Value == "true" then
if hit.Parent:FindFirstChild("Bot")then
hit.Parent.HumanoidRootPart.Anchored = true
BotOpenSound:Play()
Door.OpenClosed.Value = "Open"
DoorReady.Value = "false"
wait(1)
hit.Parent.HumanoidRootPart.Anchored = false
OpenSound:Play()
OpenTween:Play()
else
end
end
end)
|
--
|
end
else
print("sh")
end
else
print("arms")
end
end
function Key(key)
if key then
key = string.lower(key)
if (key=="n") then
if on == 1 then
on = 0
elseif on == 0 then
on = 1
end
Crouch(on)
end
end
end
function Equip(mouse)
mouse.KeyDown:connect(Key)
end
script.Parent.Equipped:connect(Equip)
|
--Settings localized
|
local Rate = Settings.Rate
local Size = Settings.Size
local Tint = Settings.Tint or Color3.fromRGB(226, 244, 255)
local Fade = Settings.Fade
|
--Variables
|
local rep = game:GetService("ReplicatedStorage") --You can change this to ServerStorage for more security.
local nametag = rep.NameTag
|
--[=[
Overwrites a table's value
@param target table -- Target table
@param source table -- Table to read from
@return table -- target
]=]
|
function Table.deepOverwrite(target, source)
for index, value in pairs(source) do
if type(target[index]) == "table" and type(value) == "table" then
target[index] = Table.deepOverwrite(target[index], value)
else
target[index] = value
end
end
return target
end
|
--[[Susupension]]
|
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 100 -- Spring Dampening
Tune.FSusStiffness = 20 -- Spring Force
Tune.FAntiRoll = 100 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FPreCompress = .3 -- Pre-compression adds resting length force
Tune.FExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.FCompressLim = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 100 -- Spring Dampening
Tune.RSusStiffness = 20 -- Spring Force
Tune.FAntiRoll = 100 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RPreCompress = .3 -- Pre-compression adds resting length force
Tune.RExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.RCompressLim = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = false -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Bright red" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
-- Door moving function
|
function Move(O)
DoorLogo.Moving:Play()
for i = 1, 58 do
wait(0.01)
-- Changes the door cframe position.
local X, Y, Z = DoorSeg.CFrame.X, DoorSeg.CFrame.Y, DoorSeg.CFrame.Z
Door:SetPrimaryPartCFrame(DoorSeg.CFrame * CFrame.new((O and -0.1 or 0.1),0,0))
end
DoorLogo.Moving:Stop()
DoorLogo.Closed:Play()
end
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["Otter"]["Otter"])
return Package
|
--------------------
--| Script Logic |--
--------------------
|
BaseShot = Instance.new('Part')
BaseShot.Name = 'Effect'
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(0.2, 0.2, 3)
BaseShot.CanCollide = false
BaseShot.BrickColor = BrickColor.new('Toothpaste')
SelectionBoxify(BaseShot)
Light(BaseShot)
HitFadeSound:Clone().Parent = BaseShot
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
Tool.Activated:connect(OnActivated)
|
---------------------------
--Seat Offset (Make copies of this block for passenger seats)
|
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,0,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
end
end)
|
--[[
Returns a new window component associated with specified model.
]]
|
function Window.new(model)
local component = {
_model = model,
_state = Constants.State.Window.Normal,
_connections = {}
}
setmetatable(component, {__index = Window})
component._connections.repairConnection =
model:FindFirstChild("Glass").Touched:Connect(
function(otherPart)
if otherPart.Anchored then
return
end
if
CollectionService:HasTag(otherPart, Constants.Tag.Tool.RepairKit) and
component._state == Constants.State.Window.Breached
then
otherPart:Destroy()
component:fix()
end
end
)
return component
end
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 30 -- cooldown for use of the tool again
BoneModelName = "Final attack" -- name the zone model
HumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--==================================================
|
local function Enabler(Hit)
if Enabled and Hit and Hit.Parent then
local AmmoRefilled = false
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player then
for _, GunName in pairs(GunToRefillAmmo) do
local Gun = Player.Backpack:FindFirstChild(GunName) or Player.Character:FindFirstChild(GunName)
if Gun then
local GunScript = Gun:FindFirstChild("GunScript_Server")
local Module = Gun:FindFirstChild("Setting")
if GunScript and Module then
local Module = require(Module)
if GunScript.Ammo.Value < Module.MaxAmmo and Module.LimitedAmmoEnabled then
if Cooldown ~= 0 then
Enabled = false
AmmoBox.Sound:Play()
AmmoBox.Transparency = 1
AmmoBox.CanCollide = false
AmmoBox.SurfaceGui.Enabled = false
local function delayer()
AmmoBox.Transparency = 0
AmmoBox.CanCollide = true
AmmoBox.SurfaceGui.Enabled = true
Enabled = true
end
delay(Cooldown,delayer)
else
AmmoBox.Sound:Play()
end
AmmoRefilled = true
local ChangedAmmo = (Ammo == math.huge or GunScript.Ammo.Value+Ammo >= Module.Ammo) and Module.Ammo or (GunScript.Ammo.Value + Ammo)
GunScript.Ammo.Value = ChangedAmmo
GunScript.ChangeMagAndAmmo:FireClient(Player,Module.AmmoPerMag,ChangedAmmo)
end
end
end
end
end
end
end
AmmoBox.Touched:connect(Enabler)
|
--wait()
|
Torso = sp.Parent:WaitForChild("Torso")
LeftHip = Torso:WaitForChild("LeftHip")
RightHip = Torso:WaitForChild("RightHip")
function wait(TimeToWait)
if TimeToWait ~= nil then
local TotalTime = 0
TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
while TotalTime < TimeToWait do
TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
end
else
game:GetService("RunService").Heartbeat:wait()
end
end
|
------------------------------------------------------------
|
local TwinService = game:GetService("TweenService")
local AnimationHighLight = TweenInfo.new(3, Enum.EasingStyle.Sine ,Enum.EasingDirection.InOut)
local Info1 = {Orientation = Vector3.new(Positionn,pos1,pos3)}
local Info2 = {Orientation = Vector3.new(Positionn2,pos1,pos3)}
local AnimkaUp = TwinService:Create(Danger, AnimationHighLight, Info1 )
local AnimkaDown = TwinService:Create(Danger, AnimationHighLight, Info2 )
while true do
AnimkaDown:Play()
wait(3)
AnimkaUp:Play()
wait(3)
end
|
---Exit function
|
function module.ExitSeat()
local humanoid = getLocalHumanoid()
if not humanoid then
return false
end
local character = humanoid.Parent
if character.Humanoid.Sit == true then
for _, joint in ipairs(character.HumanoidRootPart:GetJoints()) do
if joint.Name == "SeatWeld" then
local promptLocation = joint.Part0:FindFirstChild("PromptLocation")
if promptLocation then
local proximityPrompt = promptLocation:FindFirstChildWhichIsA("ProximityPrompt")
if proximityPrompt and proximityPrompt.Name == "EndorsedVehicleProximityPromptV1" then
for _, func in pairs(module.OnExitFunctions) do
func(joint.Part0)
end
ExitSeat:FireServer()
-- stop playing animations
for name, track in pairs(AnimationTracks) do
track:Stop()
end
return true
end
end
end
end
end
end
|
-- functions
|
function stopAllAnimations()
local oldAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end
if currentlyPlayingEmote then
oldAnim = "idle"
currentlyPlayingEmote = false
end
currentAnim = ""
currentAnimInstance = nil
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
for _,v in pairs(locomotionMap) do
if v.track then
v.track:Stop()
v.track:Destroy()
v.track = nil
end
end
return oldAnim
end
function getHeightScale()
if Humanoid then
if not Humanoid.AutomaticScalingEnabled then
return 1
end
local scale = Humanoid.HipHeight / HumanoidHipHeight
if AnimationSpeedDampeningObject == nil then
AnimationSpeedDampeningObject = script:FindFirstChild("ScaleDampeningPercent")
end
if AnimationSpeedDampeningObject ~= nil then
scale = 1 + (Humanoid.HipHeight - HumanoidHipHeight) * AnimationSpeedDampeningObject.Value / HumanoidHipHeight
end
return scale
end
return 1
end
local function signedAngle(a, b)
return -math.atan2(a.x * b.y - a.y * b.x, a.x * b.x + a.y * b.y)
end
local angleWeight = 2.0
local function get2DWeight(px, p1, p2, sx, s1, s2)
local avgLength = 0.5 * (s1 + s2)
local p_1 = {x = (sx - s1)/avgLength, y = (angleWeight * signedAngle(p1, px))}
local p12 = {x = (s2 - s1)/avgLength, y = (angleWeight * signedAngle(p1, p2))}
local denom = smallButNotZero + (p12.x*p12.x + p12.y*p12.y)
local numer = p_1.x * p12.x + p_1.y * p12.y
local r = math.clamp(1.0 - numer/denom, 0.0, 1.0)
return r
end
local function blend2D(targetVelo, targetSpeed)
local h = {}
local sum = 0.0
for n,v1 in pairs(locomotionMap) do
if targetVelo.x * v1.lv.x < 0.0 or targetVelo.y * v1.lv.y < 0 then
-- Require same quadrant as target
h[n] = 0.0
continue
end
h[n] = math.huge
for j,v2 in pairs(locomotionMap) do
if targetVelo.x * v2.lv.x < 0.0 or targetVelo.y * v2.lv.y < 0 then
-- Require same quadrant as target
continue
end
h[n] = math.min(h[n], get2DWeight(targetVelo, v1.lv, v2.lv, targetSpeed, v1.speed, v2.speed))
end
sum += h[n]
end
--truncates below 10% contribution
local sum2 = 0.0
local weightedVeloX = 0
local weightedVeloY = 0
for n,v in pairs(locomotionMap) do
if (h[n] / sum > 0.1) then
sum2 += h[n]
weightedVeloX += h[n] * v.lv.x
weightedVeloY += h[n] * v.lv.y
else
h[n] = 0.0
end
end
local animSpeed
local weightedSpeedSquared = weightedVeloX * weightedVeloX + weightedVeloY * weightedVeloY
if weightedSpeedSquared > smallButNotZero then
animSpeed = math.sqrt(targetSpeed * targetSpeed / weightedSpeedSquared)
else
animSpeed = 0
end
animSpeed = animSpeed / getHeightScale()
local groupTimePosition = 0
for n,v in pairs(locomotionMap) do
if v.track.IsPlaying then
groupTimePosition = v.track.TimePosition
break
end
end
for n,v in pairs(locomotionMap) do
-- if not loco
if h[n] > 0.0 then
if not v.track.IsPlaying then
v.track:Play(runBlendtime)
v.track.TimePosition = groupTimePosition
end
local weight = math.max(smallButNotZero, h[n] / sum2)
v.track:AdjustWeight(weight, runBlendtime)
v.track:AdjustSpeed(animSpeed)
else
v.track:Stop(runBlendtime)
end
end
end
local function getWalkDirection()
local walkToPoint = Humanoid.WalkToPoint
local walkToPart = Humanoid.WalkToPart
if Humanoid.MoveDirection ~= Vector3.zero then
return Humanoid.MoveDirection
elseif walkToPart or walkToPoint ~= Vector3.zero then
local destination
if walkToPart then
destination = walkToPart.CFrame:PointToWorldSpace(walkToPoint)
else
destination = walkToPoint
end
local moveVector = Vector3.zero
if Humanoid.RootPart then
moveVector = destination - Humanoid.RootPart.CFrame.Position
moveVector = Vector3.new(moveVector.x, 0.0, moveVector.z)
local mag = moveVector.Magnitude
if mag > 0.01 then
moveVector /= mag
end
end
return moveVector
else
return Humanoid.MoveDirection
end
end
local function updateVelocity(currentTime)
local tempDir
if locomotionMap == strafingLocomotionMap then
local moveDirection = getWalkDirection()
if not Humanoid.RootPart then
return
end
local cframe = Humanoid.RootPart.CFrame
if math.abs(cframe.UpVector.Y) < smallButNotZero or pose ~= "Running" or humanoidSpeed < 0.001 then
-- We are horizontal! Do something (turn off locomotion)
for n,v in pairs(locomotionMap) do
if v.track then
v.track:AdjustWeight(smallButNotZero, runBlendtime)
end
end
return
end
local lookat = cframe.LookVector
local direction = Vector3.new(lookat.X, 0.0, lookat.Z)
direction = direction / direction.Magnitude --sensible upVector means this is non-zero.
local ly = moveDirection:Dot(direction)
if ly <= 0.0 and ly > -0.05 then
ly = smallButNotZero -- break quadrant ties in favor of forward-friendly strafes
end
local lx = direction.X*moveDirection.Z - direction.Z*moveDirection.X
local tempDir = Vector2.new(lx, ly) -- root space moveDirection
local delta = Vector2.new(tempDir.x-cachedLocalDirection.x, tempDir.y-cachedLocalDirection.y)
-- Time check serves the purpose of the old keyframeReached sync check, as it syncs anim timePosition
if delta:Dot(delta) > 0.001 or math.abs(humanoidSpeed - cachedRunningSpeed) > 0.01 or currentTime - lastBlendTime > 1 then
cachedLocalDirection = tempDir
cachedRunningSpeed = humanoidSpeed
lastBlendTime = currentTime
blend2D(cachedLocalDirection, cachedRunningSpeed)
end
else
if math.abs(humanoidSpeed - cachedRunningSpeed) > 0.01 or currentTime - lastBlendTime > 1 then
cachedRunningSpeed = humanoidSpeed
lastBlendTime = currentTime
blend2D(Vector2.yAxis, cachedRunningSpeed)
end
end
end
function setAnimationSpeed(speed)
if currentAnim ~= "walk" then
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end
end
function keyFrameReachedFunc(frameName)
if (frameName == "End") then
local repeatAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
repeatAnim = "idle"
end
if currentlyPlayingEmote then
if currentAnimTrack.Looped then
-- Allow the emote to loop
return
end
repeatAnim = "idle"
currentlyPlayingEmote = false
end
local animSpeed = currentAnimSpeed
playAnimation(repeatAnim, 0.15, Humanoid)
setAnimationSpeed(animSpeed)
end
end
function rollAnimation(animName)
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
return idx
end
local function switchToAnim(anim, animName, transitionTime, humanoid)
-- switch animation
if (anim ~= currentAnimInstance) then
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop(transitionTime)
currentAnimTrack:Destroy()
end
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
currentAnimSpeed = 1.0
currentAnim = animName
currentAnimInstance = anim -- nil in the case of locomotion
if animName == "walk" then
setupWalkAnimations()
else
destroyWalkAnimations()
-- load it to the humanoid; get AnimationTrack
currentAnimTrack = humanoid:LoadAnimation(anim)
currentAnimTrack.Priority = Enum.AnimationPriority.Core
currentAnimTrack:Play(transitionTime)
-- set up keyframe name triggers
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
end
end
end
function playAnimation(animName, transitionTime, humanoid)
local idx = rollAnimation(animName)
local anim = animTable[animName][idx].anim
switchToAnim(anim, animName, transitionTime, humanoid)
currentlyPlayingEmote = false
end
function playEmote(emoteAnim, transitionTime, humanoid)
switchToAnim(emoteAnim, emoteAnim.Name, transitionTime, humanoid)
currentlyPlayingEmote = true
end
|
------------
--[[CODE]]--
------------
|
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Offset = Vector3.new()
local Player = Players.LocalPlayer
function Update()
local Character = Player.Character --I'll have this here, should the script be in StarterPlayerScripts
local Camera = workspace.CurrentCamera --In case they delete the camera or something.
if not Character then
return
end
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Head = Character:WaitForChild("Head")
for Index, Item in ipairs(Character:GetChildren()) do
if Item:IsA("BasePart") then
if Item.Name ~= "Head" then
Item.LocalTransparencyModifier = 0
end
elseif Item:IsA("Accoutrement") then
local Handle = Item:FindFirstChild("Handle")
if Handle then
local ConnectedToHead = (Handle:FindFirstChild("HatAttachment") or Handle:FindFirstChild("HairAttachment") or Handle:FindFirstChild("FaceAttachment") or Handle:FindFirstChild("NeckAttachment")) ~= nil
if ConnectedToHead then
if ViewAccessories and ViewHeadAccessories then
Handle.LocalTransparencyModifier = 0
end
else
if ViewAccessories then
Handle.LocalTransparencyModifier = 0
end
end
end
end
end
if (RealisticView and Player.CameraMode == Enum.CameraMode.LockFirstPerson)
or (Character:WaitForChild("Head").LocalTransparencyModifier == 1) then
--Above: Adding [or (Character:WaitForChild("Head").LocalTransparencyModifier == 1)] will make it so we can
--detect if the player is in first-person
local Origin = Camera.CFrame
local Out = Camera.CFrame * CFrame.new(0, 0, -1)
local Y_Diff = (Origin.Y - Out.Y) * -1
local Z_Diff = 0
local Extra_X = 0
local Extra_Y = 1.5
local Camera_Offset = Vector3.new(0, 0, math.min(Y_Diff - Z_Diff, 0))
--Update #2: R15 offsets cause issues with this code block. This next one will fix that.
local UpperTorso = Character:FindFirstChild("UpperTorso")
if UpperTorso then
local OffsetVal = HumanoidRootPart.CFrame:toObjectSpace(Head.CFrame).p
Offset = Camera_Offset + (OffsetVal - Vector3.new(0, 2, 0))
else
Offset = Camera_Offset
end
Humanoid.CameraOffset = Offset
else
Humanoid.CameraOffset = Vector3.new()
end
end
if AutoLockFirstPerson then
Player.CameraMode = Enum.CameraMode.LockFirstPerson
end
RunService.RenderStepped:Connect(Update)
|
--- Cleans up all tasks.
-- @alias Destroy
|
function Maid:DoCleaning()
local tasks = self._tasks
-- Disconnect all events first as we know this is safe
for index, job in pairs(tasks) do
if typeof(job) == "RBXScriptConnection" then
tasks[index] = nil
job:Disconnect()
end
end
-- Clear out tasks table completely, even if clean up tasks add more tasks to the maid
local index, job = next(tasks)
while job ~= nil do
tasks[index] = nil
if type(job) == "function" then
job()
elseif typeof(job) == "RBXScriptConnection" then
job:Disconnect()
elseif job.Destroy then
job:Destroy()
end
index, job = next(tasks)
end
end
|
-- A set of LogInfo objects that should have messages inserted into them.
-- This is a set so that nested calls to Logging.capture will behave.
|
local collectors = {}
|
--[[Susupension]]
|
Tune.SusEnabled = true -- Sets whether suspension is enabled for PGS
--Front Suspension
Tune.FSusStiffness = 12500 -- Spring Force
Tune.FSusDamping = 650 -- Spring Dampening
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Resting Suspension length (in studs)
Tune.FPreCompress = .25 -- Pre-compression adds resting length force
Tune.FExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.FCompressLim = .8 -- Max Compression Travel (in studs)
Tune.FSusAngle = 75 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 2 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusStiffness = 12500 -- Spring Force
Tune.RSusDamping = 650 -- Spring Dampening
Tune.RAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2 -- Resting Suspension length (in studs)
Tune.RPreCompress = .25 -- Pre-compression adds resting length force
Tune.RExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.RCompressLim = .8 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 2 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics (PGS ONLY)
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Bright red" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 8 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
-- the toggleables
|
local walkSpeed = 30
local aggroRange = 60
local stateData = {
["state"] = "Idle",
["targ"] = nil,
["lastOrder"] = 0,
}
local animController = char:WaitForChild("AnimationController")
local preAnims = {
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 1 -- cooldown for use of the tool again
BoneModelName = "Spear" -- name the zone model
HumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- Public Methods
|
function SliderClass:Get()
local t = self._Spring.x
if (self.Inverted) then t = 1 - t end
return t
end
function SliderClass:Set(value, doTween)
local spring = self._Spring
local newT = math.clamp(value, 0, 1)
if (self.Interval > 0) then
newT = math.floor((newT / self.Interval) + 0.5) * self.Interval
end
spring.t = newT
spring.instant = not doTween
end
function SliderClass:Destroy()
self._Maid:Sweep()
--self.Frame:Destroy()
self.Changed = nil
self.Clicked = nil
self.StartDrag = nil
self.StopDrag = nil
self.Frame = nil
end
|
--Input
|
userInputService.InputBegan:connect(function(inputObject, processed)
if not processed then
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
plane.Shoot:FireServer(true)
end
end
end)
userInputService.InputEnded:connect(function(inputObject, processed)
if not processed then
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
plane.Shoot:FireServer(false)
end
end
end)
userInputService.InputChanged:connect(function(inputObject)
if inputObject.KeyCode == Enum.KeyCode.Thumbstick1 then
thumb1 = Vector2.new(0, inputObject.Position.Y)
if math.abs(thumb1.Y) <= 0.1 then
thumb1 = Vector2.new(thumb1.X, 0)
end
speed = math.max(thumb1.Y, 0) * config.Speed.Value
elseif inputObject.KeyCode == Enum.KeyCode.Thumbstick2 then
thumb2 = Vector2.new(inputObject.Position.X, inputObject.Position.Y)
if math.abs(thumb2.X) <= 0.1 then
thumb2 = Vector2.new(0, thumb2.Y)
end
if math.abs(thumb2.Y) <= 0.1 then
thumb2 = Vector2.new(thumb2.X, 0)
end
end
end)
while plane.Seat.Occupant == humanoid and humanoid.Health > 0 do
local deltaTime = rs:wait()
local mouseX = -thumb2.X
local mouseY = -thumb2.Y
if thumb2.magnitude <= 0 and not sliding then
mouseX = ((camera.ViewportSize.X / 2) - mouse.X) / (camera.ViewportSize.X / 2)
mouseY = ((camera.ViewportSize.Y / 2) - mouse.Y) / (camera.ViewportSize.Y / 2)
end
y = mouseY * 1.4
x = (x + (mouseX / 50) * (config.TurnSpeed.Value / 10)) % (math.pi * 2)
if userInputService:IsKeyDown(Enum.KeyCode.W) then
speed = math.min(speed + deltaTime * 100, config.Speed.Value)
elseif userInputService:IsKeyDown(Enum.KeyCode.S) then
speed = math.max(speed - deltaTime * 100, 0)
end
local power = speed / config.Speed.Value
camera.CoordinateFrame = camera.CoordinateFrame:lerp(CFrame.new(body.Position) * CFrame.Angles(0, x, 0) * CFrame.Angles(y, 0, 0) * CFrame.new(0, 10, 30), deltaTime * 15)
bodyGyro.CFrame = camera.CoordinateFrame * CFrame.Angles(0, 0, mouseX)
bodyGyro.MaxTorque = Vector3.new(power, power, power) * config.TurnSpeed.Value
bodyVelocity.Velocity = body.CFrame.lookVector * config.Speed.Value
bodyVelocity.MaxForce = Vector3.new(1000000, 1000000, 1000000) * power
if config.GunsEnabled.Value then
plane.AimPart.CFrame = body.CFrame * CFrame.new(0, 8, -100)
end
end
bodyGyro:Destroy()
bodyVelocity:Destroy()
if aimGui then
aimGui:Destroy()
end
if mobileGui then
mobileGui:Destroy()
end
camera.CameraType = cameraType
userInputService.ModalEnabled = false
script:Destroy()
|
-- @Return Int
|
function WeaponRuntimeData:GetCurrentAmmo()
return self.currentAmmo
end
|
--[[ Touch Events ]]--
-- On touch devices we need to recreate the guis on character load.
|
local lastControlState = nil
LocalPlayer.CharacterAdded:connect(function(character)
if ControlState.Current then -- only do this if it wasn't done through CharacterRemoving
lastControlState = ControlState.Current
ControlState:SwitchTo(nil)
end
if UserInputService.TouchEnabled then
createTouchGuiContainer()
end
if ControlState.Current == nil then
ControlState:SwitchTo(lastControlState)
end
end)
LocalPlayer.CharacterRemoving:connect(function()
lastControlState = ControlState.Current
ControlState:SwitchTo(nil)
end)
UserInputService.Changed:connect(function(property)
if property == 'ModalEnabled' then
IsModalEnabled = UserInputService.ModalEnabled
if lastInputType == Enum.UserInputType.Touch then
if ControlState.Current == ControlModules.Touch and IsModalEnabled then
ControlState:SwitchTo(nil)
elseif ControlState.Current == nil and not IsModalEnabled then
ControlState:SwitchTo(ControlModules.Touch)
end
end
end
end)
if BindableEvent_OnFailStateChanged then
BindableEvent_OnFailStateChanged.Event:connect(function(isOn)
if lastInputType == Enum.UserInputType.Touch and ClickToMoveTouchControls then
if isOn then
ControlState:SwitchTo(ClickToMoveTouchControls)
else
ControlState:SwitchTo(nil)
end
end
end)
end
local switchToInputType = function(newLastInputType)
lastInputType = newLastInputType
if lastInputType == Enum.UserInputType.Touch then
ControlState:SwitchTo(ControlModules.Touch)
elseif lastInputType == Enum.UserInputType.Keyboard or
lastInputType == Enum.UserInputType.MouseButton1 or
lastInputType == Enum.UserInputType.MouseButton2 or
lastInputType == Enum.UserInputType.MouseButton3 or
lastInputType == Enum.UserInputType.MouseWheel or
lastInputType == Enum.UserInputType.MouseMovement then
ControlState:SwitchTo(ControlModules.Keyboard)
elseif lastInputType == Enum.UserInputType.Gamepad1 or
lastInputType == Enum.UserInputType.Gamepad2 or
lastInputType == Enum.UserInputType.Gamepad3 or
lastInputType == Enum.UserInputType.Gamepad4 then
ControlState:SwitchTo(ControlModules.Gamepad)
end
end
if IsTouchDevice then
createTouchGuiContainer()
end
MasterControl:Init()
UserInputService.GamepadDisconnected:connect(function(gamepadEnum)
local connectedGamepads = UserInputService:GetConnectedGamepads()
if #connectedGamepads > 0 then return end
if UserInputService.KeyboardEnabled then
ControlState:SwitchTo(ControlModules.Keyboard)
elseif IsTouchDevice then
ControlState:SwitchTo(ControlModules.Touch)
end
end)
UserInputService.GamepadConnected:connect(function(gamepadEnum)
ControlState:SwitchTo(ControlModules.Gamepad)
end)
switchToInputType(UserInputService:GetLastInputType())
UserInputService.LastInputTypeChanged:connect(switchToInputType)
|
--Turbocharger
|
local BOV_Loudness = 7 --volume of the BOV (not exact volume so you kinda have to experiment with it)
local BOV_Pitch = 0.9 --max pitch of the BOV (not exact so might have to mess with it)
|
-- RAGDOLL A R6 CHARACTER.
|
local function getAttachment0(attachmentName, char)
for _,child in next,char:GetChildren() do
local attachment = child:FindFirstChild(attachmentName)
if attachment then
return attachment
end
end
end
local SIZE = 1.3
local function ragdollPlayer(char)
local head = char["Head"]
local hum = char:WaitForChild("Humanoid")
local leftarm = char["Left Arm"]
local leftleg = char["Left Leg"]
local rightleg = char["Right Leg"]
local rightarm = char["Right Arm"]
local torso = char.Torso
hum.PlatformStand = true
local root =char:FindFirstChild("HumanoidRootPart")
if root ~= nil then
root:Destroy()
end
local rootA =Instance.new("Attachment")
local HeadA = Instance.new("Attachment")
local LeftArmA = Instance.new("Attachment")
local LeftLegA = Instance.new("Attachment")
local RightArmA = Instance.new("Attachment")
local RightLegA = Instance.new("Attachment")
local TorsoA = Instance.new("Attachment")
local TorsoA1 = Instance.new("Attachment")
local TorsoA2 = Instance.new("Attachment")
local TorsoA3 = Instance.new("Attachment")
local TorsoA4 = Instance.new("Attachment")
local TorsoA5 = Instance.new("Attachment")
local function set1()
HeadA.Name = "HeadA"
HeadA.Parent = head
HeadA.Position = Vector3.new(0, -0.5*SIZE, 0)
HeadA.Rotation = Vector3.new(0, 0, 0)
HeadA.Axis = Vector3.new(1*SIZE, 0, 0)
HeadA.SecondaryAxis = Vector3.new(0, 1*SIZE, 0)
LeftArmA.Name = "LeftArmA"
LeftArmA.Parent = leftarm
LeftArmA.Position = Vector3.new(0.5*SIZE, 1*SIZE, 0)
LeftArmA.Rotation = Vector3.new(0, 0, 0)
LeftArmA.Axis = Vector3.new(1*SIZE, 0, 0)
LeftArmA.SecondaryAxis = Vector3.new(0, 1*SIZE, 0)
LeftLegA.Name = "LeftLegA"
LeftLegA.Parent = leftleg
LeftLegA.Position = Vector3.new(0, 1*SIZE, 0)
LeftLegA.Rotation = Vector3.new(0, 0, 0)
LeftLegA.Axis = Vector3.new(1*SIZE, 0, 0)
LeftLegA.SecondaryAxis = Vector3.new(0, 1*SIZE, 0)
RightArmA.Name = "RightArmA"
RightArmA.Parent = rightarm
RightArmA.Position = Vector3.new(-0.5*SIZE, 1*SIZE, 0)
RightArmA.Rotation = Vector3.new(0, 0, 0)
RightArmA.Axis = Vector3.new(1*SIZE, 0, 0)
RightArmA.SecondaryAxis = Vector3.new(0, 1*SIZE, 0)
RightLegA.Name = "RightLegA"
RightLegA.Parent = rightleg
RightLegA.Position = Vector3.new(0, 1*SIZE, 0)
RightLegA.Rotation = Vector3.new(0, 0, 0)
RightLegA.Axis = Vector3.new(1*SIZE, 0, 0)
RightLegA.SecondaryAxis = Vector3.new(0, 1*SIZE, 0)
rootA.Name= "rootA"
rootA.Parent = root
rootA.Position = Vector3.new(0, 0, 0)
rootA.Rotation = Vector3.new(0, 90*SIZE, 0)
rootA.Axis = Vector3.new(0, 0, -1*SIZE)
rootA.SecondaryAxis = Vector3.new(0, 1*SIZE, 0)
end
local function set2()
TorsoA.Name = "TorsoA"
TorsoA.Parent = torso
TorsoA.Position = Vector3.new(0.5*SIZE, -1*SIZE, 0)
TorsoA.Rotation = Vector3.new(0, 0, 0)
TorsoA.Axis = Vector3.new(1*SIZE, 0, 0)
TorsoA.SecondaryAxis = Vector3.new(0, 1*SIZE, 0)
TorsoA1.Name = "TorsoA1"
TorsoA1.Parent = torso
TorsoA1.Position = Vector3.new(-0.5*SIZE, -1*SIZE, 0)
TorsoA1.Rotation = Vector3.new(0, 0, 0)
TorsoA1.Axis = Vector3.new(1*SIZE, 0, 0)
TorsoA1.SecondaryAxis = Vector3.new(0, 1*SIZE, 0)
TorsoA2.Name = "TorsoA2"
TorsoA2.Parent = torso
TorsoA2.Position = Vector3.new(-1*SIZE, 1*SIZE, 0)
TorsoA2.Rotation = Vector3.new(0, 0, 0)
TorsoA2.Axis = Vector3.new(1*SIZE, 0, 0)
TorsoA2.SecondaryAxis = Vector3.new(0, 1*SIZE, 0)
TorsoA3.Name = "TorsoA3"
TorsoA3.Parent = torso
TorsoA3.Position = Vector3.new(1*SIZE, 1*SIZE, 0)
TorsoA3.Rotation = Vector3.new(0, 0, 0)
TorsoA3.Axis = Vector3.new(1*SIZE, 0, 0)
TorsoA3.SecondaryAxis = Vector3.new(0, 1*SIZE, 0)
TorsoA4.Name = "TorsoA4"
TorsoA4.Parent = torso
TorsoA4.Position = Vector3.new(0, 1*SIZE, 0)
TorsoA4.Rotation = Vector3.new(0, 0, 0)
TorsoA4.Axis = Vector3.new(1*SIZE, 0, 0)
TorsoA4.SecondaryAxis = Vector3.new(0, 1*SIZE, 0)
TorsoA5.Name = "TorsoA5"
TorsoA5.Parent = torso
TorsoA5.Position = Vector3.new(0, 0, 0)
TorsoA5.Rotation = Vector3.new(0, 90*SIZE, 0)
TorsoA5.Axis = Vector3.new(0, 0, -1*SIZE)
TorsoA5.SecondaryAxis = Vector3.new(0, 1*SIZE, 0)
end
spawn(set1)
spawn(set2)
--[[
local HA = Instance.new("HingeConstraint")
HA.Parent = head
HA.Attachment0 = HeadA
HA.Attachment1 = TorsoA4
HA.Enabled = true
HA.LimitsEnabled=true
HA.LowerAngle=0
HA.UpperAngle=0
--]]
local LAT = Instance.new("BallSocketConstraint")
LAT.Parent = leftarm
LAT.Attachment0 = LeftArmA
LAT.Attachment1 = TorsoA2
LAT.Enabled = true
LAT.LimitsEnabled=true
LAT.UpperAngle=90
local RAT = Instance.new("BallSocketConstraint")
RAT.Parent = rightarm
RAT.Attachment0 = RightArmA
RAT.Attachment1 = TorsoA3
RAT.Enabled = true
RAT.LimitsEnabled=false
RAT.UpperAngle=90
local HA = Instance.new("BallSocketConstraint")
HA.Parent = head
HA.Attachment0 = HeadA
HA.Attachment1 = TorsoA4
HA.Enabled = true
HA.LimitsEnabled = true
HA.TwistLimitsEnabled = true
HA.UpperAngle = 74
local TLL = Instance.new("BallSocketConstraint")
TLL.Parent = torso
TLL.Attachment0 = TorsoA1
TLL.Attachment1 = LeftLegA
TLL.Enabled = true
TLL.LimitsEnabled=true
TLL.UpperAngle=90
local TRL = Instance.new("BallSocketConstraint")
TRL.Parent = torso
TRL.Attachment0 = TorsoA
TRL.Attachment1 = RightLegA
TRL.Enabled = true
TRL.LimitsEnabled=true
TRL.UpperAngle=90
local RTA = Instance.new("BallSocketConstraint")
RTA.Parent = root
RTA.Attachment0 = rootA
RTA.Attachment1 = TorsoA5
RTA.Enabled = true
RTA.LimitsEnabled=true
RTA.UpperAngle=0
head.Velocity = head.CFrame.p * CFrame.new(0, -41*SIZE, 0).p
for _,child in next,char:GetChildren() do
if child:IsA("Accoutrement") then
for _,part in next,child:GetChildren() do
if part:IsA("BasePart") then
part.Parent = char
child:remove()
local attachment1 = part:FindFirstChildOfClass("Attachment")
local attachment0 = getAttachment0(attachment1.Name, char)
if attachment0 and attachment1 then
local constraint = Instance.new("HingeConstraint")
constraint.Attachment0 = attachment0
constraint.Attachment1 = attachment1
constraint.LimitsEnabled = true
constraint.UpperAngle = 0
constraint.LowerAngle = 0
constraint.Parent = char
end
end
end
end
end
end
return ragdollPlayer
|
-- при добавлении и удалении потомка
|
ls.ChildAdded:Connect(UpdateList)
|
---
|
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.MouseButton1Click:connect(function()
if hinge.DesiredAngle == 0 then
sound.SoundId = "rbxassetid://278329638"
sound:Play()
wait(.4)
hinge.DesiredAngle = -.75
else
hinge.DesiredAngle = 0
sound.SoundId = "rbxassetid://278329638"
sound:Play()
end
end)
|
--Creates a random droplet on screen
|
local function CreateDroplet()
--Setup
local stretch = 1 + math.random(15) / 10
local RunAmount = math.random(4)
local Tweens = table.create(RunAmount * 2 + 2)
local TweensLength = 0
local SizeOffset = math.random((Size / 3) * -10, (Size / 3) * 10) / 10
local Scale = Size + SizeOffset
local MeshScale = Vector3.new(Scale, Scale, Scale)
--Main droplet object
local DropletMain = Instance.new("Part")
DropletMain.Material = Enum.Material.Glass
DropletMain.CFrame = EMPTY_CFRAME
DropletMain.CanCollide = false
DropletMain.Transparency = 0.5
DropletMain.Name = "Droplet_Main"
DropletMain.Color = Tint
DropletMain.Size = DROPLET_SIZE
local Mesh = Instance.new("SpecialMesh")
Mesh.MeshType = Enum.MeshType.Sphere
Mesh.Scale = MeshScale
Mesh.Parent = DropletMain
--Create droplet extrusions
for i = 1, RunAmount do
local eSizeOffset = math.random(
(Size / 3) * -100,
(Size / 3) * 100
) / 100
local ExtrusionCFrame = CFrame.new(Vector3.new(
math.random(-(Size * 40), Size * 40) / 100,
math.random(-(Size * 40), Size * 40) / 100,
0
))
local ExtrusionScale = Size / 1.5 + eSizeOffset
local ExtrusionMeshScale = Vector3.new(ExtrusionScale, ExtrusionScale, ExtrusionScale)
local Extrusion = Instance.new("Part")
Extrusion.Material = Enum.Material.Glass
Extrusion.CFrame = ExtrusionCFrame
Extrusion.CanCollide = false
Extrusion.Transparency = 0.5
Extrusion.Name = "Extrusion_" .. i
Extrusion.Color = Tint
Extrusion.Size = DROPLET_SIZE
local ExtrusionMesh = Instance.new("SpecialMesh")
ExtrusionMesh.MeshType = Enum.MeshType.Sphere
ExtrusionMesh.Scale = ExtrusionMeshScale
ExtrusionMesh.Parent = Extrusion
Extrusion.Parent = DropletMain
local weld = Instance.new("Weld")
weld.C0 = ExtrusionCFrame:Inverse() * EMPTY_CFRAME
weld.Part0 = Extrusion
weld.Part1 = DropletMain
weld.Parent = Extrusion
IgnoreLength = IgnoreLength + 1
TweensLength = TweensLength + 1
ignoreList[IgnoreLength] = Extrusion
Tweens[TweensLength] = TweenService:Create(Extrusion, fadeInfo, fadeGoal)
TweensLength = TweensLength + 1
Tweens[TweensLength] = TweenService:Create(ExtrusionMesh, strechInfo, {
Scale = Vector3.new(ExtrusionScale, ExtrusionScale * stretch, ExtrusionScale);
Offset = Vector3.new(0, -(ExtrusionScale * stretch) / 2.05, 0);
})
end
IgnoreLength = IgnoreLength + 1
TweensLength = TweensLength + 1
ignoreList[IgnoreLength] = DropletMain
Tweens[TweensLength] = TweenService:Create(DropletMain, fadeInfo, fadeGoal)
TweensLength = TweensLength + 1
Tweens[TweensLength] = TweenService:Create(Mesh, strechInfo, {
Scale = Vector3.new(Scale, Scale * stretch, Scale);
Offset = Vector3.new(0, -(Scale * stretch) / 2.05, 0);
})
local NewCFrame = ScreenBlockCFrame:ToWorldSpace(CFrame.new(
math.random(-100, 100) / 100,
math.random(-100, 100) / 100,
-1
))
DropletMain.CFrame = NewCFrame
local weld = Instance.new("Weld")
weld.C0 = NewCFrame:Inverse() * ScreenBlockCFrame
weld.Part0 = DropletMain
weld.Part1 = ScreenBlock
weld.Parent = DropletMain
for _, t in ipairs(Tweens) do
t:Play()
end
local DestroyRoutine = coroutine.create(DestroyDroplet)
coroutine.resume(DestroyRoutine, DropletMain)
DropletMain.Parent = ScreenBlock
end
local function OnGraphicsChanged()
CanShow = GameSettings.SavedQualityLevel.Value >= 8
end
GameSettings:GetPropertyChangedSignal("SavedQualityLevel"):Connect(OnGraphicsChanged)
|
--[[Flip]]
|
function Flip()
--Detect Orientation
if (car.DriveSeat.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector.y > .1 or FlipDB then
FlipWait=tick()
--Apply Flip
else
if tick()-FlipWait>=3 then
FlipDB=true
local gyro = car.DriveSeat.Flip
gyro.maxTorque = Vector3.new(10000,0,10000)
gyro.P=3000
gyro.D=500
wait(1)
gyro.maxTorque = Vector3.new(0,0,0)
gyro.P=0
gyro.D=0
FlipDB=false
end
end
end
|
------------------------------------
|
function onTouched(part)
if part.Parent ~= nil then
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid then
return
end
local teleportto=script.Parent.Parent:findFirstChild(modelname)
if teleportto~=nil then
local torso = h.Parent.Torso
local location = {teleportto.Position}
local i = 1
local x = location[i].x
local y = location[i].y
local z = location[i].z
x = x + math.random(-1, 1)
z = z + math.random(-1, 1)
y = y + math.random(2, 3)
local cf = torso.CFrame
local lx = 0
local ly = y
local lz = 0
script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(0.01)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
else
print("")
end
end
end
end
end
script.Parent.Touched:connect(onTouched)
|
--while true do
-- for i = 10, 1, -1 do
-- script.Parent.Orientation = script.Parent.Orientation + Vector3.new(0, i/2, 0)
-- wait()
-- end
-- wait(1)
--end
|
game.ReplicatedStorage.PedalEvent.OnServerEvent:Connect(function()
print('touched 2')
for i = 1, 10 do
script.Parent.Orientation = script.Parent.Orientation + Vector3.new(0, 12, 0)
wait()
end
end)
|
--[[Susupension]]
|
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 1000 -- Spring Dampening
Tune.FSusStiffness = 5000 -- Spring Force
Tune.FSusLength = 3 -- Suspension length (in studs)
Tune.FSusMaxExt = 1 -- Max Extension Travel (in studs)
Tune.FSusMaxComp = 3 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 1000 -- Spring Dampening
Tune.RSusStiffness = 5000 -- Spring Force
Tune.RSusLength = 3 -- Suspension length (in studs)
Tune.RSusMaxExt = 1 -- Max Extension Travel (in studs)
Tune.RSusMaxComp = 3 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = false -- Spring Visible
Tune.WsBVisible = true -- Wishbone Visible
Tune.SusRadius = .4 -- Suspension Coil Radius
Tune.SusThickness = .15 -- Suspension Coil Thickness
Tune.SusColor = "Bright red" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 8 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .3 -- Wishbone Rod Thickness
|
--[[if JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Thumbnail")then]]--
--[[JeffTheKiller:FindFirstChild("Thumbnail"):Destroy();]]--
--[[end;]]
|
--
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local AttackDebounce=false;
local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Knife");
local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head");
local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart");
local WalkDebounce=false;
local Notice=false;
local JeffLaughDebounce=false;
local MusicDebounce=false;
local NoticeDebounce=false;
local ChosenMusic;
function FindNearestBae()
local NoticeDistance=100;
local TargetMain;
for _,TargetModel in pairs(Game:GetService("Workspace"):GetChildren())do
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("HumanoidRootPart")and TargetModel:FindFirstChild("Head")then
local TargetPart=TargetModel:FindFirstChild("HumanoidRootPart");
local FoundHumanoid;
for _,Child in pairs(TargetModel:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then
TargetMain=TargetPart;
NoticeDistance=(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude;
local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).unit,500)
if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("HumanoidRootPart")and hit.Parent:FindFirstChild("Head")then
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<9 and not AttackDebounce then
Spawn(function()
AttackDebounce=true;
local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("Swing"));
local SwingChoice=math.random(1,2);
local HitChoice=math.random(1,3);
SwingAnimation:Play();
SwingAnimation:AdjustSpeed(1.5+(math.random()*0.1));
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Swing")then
local SwingSound=JeffTheKillerKnife:FindFirstChild("Swing");
SwingSound.Pitch=1+(math.random()*0.04);
SwingSound:Play();
end;
Wait(0.3);
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then
FoundHumanoid:TakeDamage(30);
if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit1")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit1");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit2")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit2");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit3")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit3");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
end;
end;
Wait(0.1);
AttackDebounce=false;
end);
end;
end;
end;
end;
end;
return TargetMain;
end;
while Wait(0)do
local TargetPoint=JeffTheKillerHumanoid.TargetPoint;
local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRootPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector,(JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller})
local Jumpable=false;
if Blockage then
Jumpable=true;
if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then
local BlockageHumanoid;
for _,Child in pairs(Blockage.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
BlockageHumanoid=Child;
end;
end;
if Blockage and Blockage:IsA("Terrain")then
local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0)));
local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos.Z);
if CellMaterial==Enum.CellMaterial.Water then
Jumpable=false;
end;
elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool"then
Jumpable=false;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then
JeffTheKillerHumanoid.Jump=true;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("Jeff_Step")and (JeffTheKillerHumanoidRootPart.Velocity-Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
Spawn(function()
WalkDebounce=true;
local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0));
local RayTarget,endPoint=Game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKiller);
if RayTarget then
local JeffTheKillerHeadFootStepClone=JeffTheKillerHead:FindFirstChild("Jeff_Step"):Clone();
JeffTheKillerHeadFootStepClone.Parent=JeffTheKillerHead;
JeffTheKillerHeadFootStepClone:Play();
JeffTheKillerHeadFootStepClone:Destroy();
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<15 then
Wait(0.5);
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>15 then
Wait(0.2);
end
end;
WalkDebounce=false;
end);
end;
local MainTarget=FindNearestBae();
local FoundHumanoid;
if MainTarget then
for _,Child in pairs(MainTarget.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and MainTarget.Parent and FoundHumanoid and FoundHumanoid.Jump then
JeffTheKillerHumanoid.Jump=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and not JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=1;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
if not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
end;
end;
if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<50 then
local MusicChoice=math.random(1,2);
if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1");
elseif MusicChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2");
end;
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then
ChosenMusic.Volume=0.5;
ChosenMusic:Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>50 then
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then
if not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
end;
end;
if not MainTarget and not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
if not MainTarget and not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
if MainTarget then
Notice=true;
if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Susto2")then
JeffTheKillerHead:FindFirstChild("Jeff_Susto2"):Play();
NoticeDebounce=true;
end
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then
JeffTheKillerHumanoid.WalkSpeed=25;
elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then
JeffTheKillerHumanoid.WalkSpeed=0.004;
end;
JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).unit*2,Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
else
Notice=false;
NoticeDebounce=false;
local RandomWalk=math.random(1,150);
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
JeffTheKillerHumanoid.WalkSpeed=12;
if RandomWalk==1 then
JeffTheKillerHumanoid:MoveTo(Game:GetService("Workspace"):FindFirstChild("Terrain").Position+Vector3.new(math.random(-2048,2048),0,math.random(-2048,2048)),Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.DisplayDistanceType="None";
JeffTheKillerHumanoid.HealthDisplayDistance=0;
JeffTheKillerHumanoid.Name="ColdBloodedKiller";
JeffTheKillerHumanoid.NameDisplayDistance=0;
JeffTheKillerHumanoid.NameOcclusion="EnemyOcclusion";
JeffTheKillerHumanoid.AutoJumpEnabled=true;
JeffTheKillerHumanoid.AutoRotate=true;
JeffTheKillerHumanoid.MaxHealth=500;
JeffTheKillerHumanoid.JumpPower=60;
JeffTheKillerHumanoid.MaxSlopeAngle=89.9;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then
JeffTheKillerHumanoid.AutoJumpEnabled=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then
JeffTheKillerHumanoid.AutoRotate=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then
JeffTheKillerHumanoid.PlatformStand=false;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then
JeffTheKillerHumanoid.Sit=false;
end;
end;
|
-- Was called OnMoveTouchEnded in previous version
|
function DynamicThumbstick:OnInputEnded()
self.moveTouchObject = nil
self.moveVector = ZERO_VECTOR3
self:FadeThumbstick(false)
end
function DynamicThumbstick:FadeThumbstick(visible: boolean?)
if not visible and self.moveTouchObject then
return
end
if self.isFirstTouch then return end
if self.startImageFadeTween then
self.startImageFadeTween:Cancel()
end
if self.endImageFadeTween then
self.endImageFadeTween:Cancel()
end
for i = 1, #self.middleImages do
if self.middleImageFadeTweens[i] then
self.middleImageFadeTweens[i]:Cancel()
end
end
if visible then
self.startImageFadeTween = TweenService:Create(self.startImage, ThumbstickFadeTweenInfo, { ImageTransparency = 0 })
self.startImageFadeTween:Play()
self.endImageFadeTween = TweenService:Create(self.endImage, ThumbstickFadeTweenInfo, { ImageTransparency = 0.2 })
self.endImageFadeTween:Play()
for i = 1, #self.middleImages do
self.middleImageFadeTweens[i] = TweenService:Create(self.middleImages[i], ThumbstickFadeTweenInfo, { ImageTransparency = MIDDLE_TRANSPARENCIES[i] })
self.middleImageFadeTweens[i]:Play()
end
else
self.startImageFadeTween = TweenService:Create(self.startImage, ThumbstickFadeTweenInfo, { ImageTransparency = 1 })
self.startImageFadeTween:Play()
self.endImageFadeTween = TweenService:Create(self.endImage, ThumbstickFadeTweenInfo, { ImageTransparency = 1 })
self.endImageFadeTween:Play()
for i = 1, #self.middleImages do
self.middleImageFadeTweens[i] = TweenService:Create(self.middleImages[i], ThumbstickFadeTweenInfo, { ImageTransparency = 1 })
self.middleImageFadeTweens[i]:Play()
end
end
end
function DynamicThumbstick:FadeThumbstickFrame(fadeDuration: number, fadeRatio: number)
self.fadeInAndOutHalfDuration = fadeDuration * 0.5
self.fadeInAndOutBalance = fadeRatio
self.tweenInAlphaStart = tick()
end
function DynamicThumbstick:InputInFrame(inputObject: InputObject)
local frameCornerTopLeft: Vector2 = self.thumbstickFrame.AbsolutePosition
local frameCornerBottomRight = frameCornerTopLeft + self.thumbstickFrame.AbsoluteSize
local inputPosition = inputObject.Position
if inputPosition.X >= frameCornerTopLeft.X and inputPosition.Y >= frameCornerTopLeft.Y then
if inputPosition.X <= frameCornerBottomRight.X and inputPosition.Y <= frameCornerBottomRight.Y then
return true
end
end
return false
end
function DynamicThumbstick:DoFadeInBackground()
local playerGui = LocalPlayer:FindFirstChildOfClass("PlayerGui")
local hasFadedBackgroundInOrientation = false
-- only fade in/out the background once per orientation
if playerGui then
if playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeLeft or
playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeRight then
hasFadedBackgroundInOrientation = self.hasFadedBackgroundInLandscape
self.hasFadedBackgroundInLandscape = true
elseif playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.Portrait then
hasFadedBackgroundInOrientation = self.hasFadedBackgroundInPortrait
self.hasFadedBackgroundInPortrait = true
end
end
if not hasFadedBackgroundInOrientation then
self.fadeInAndOutHalfDuration = FADE_IN_OUT_HALF_DURATION_DEFAULT
self.fadeInAndOutBalance = FADE_IN_OUT_BALANCE_DEFAULT
self.tweenInAlphaStart = tick()
end
end
function DynamicThumbstick:DoMove(direction: Vector3)
local currentMoveVector: Vector3 = direction
-- Scaled Radial Dead Zone
local inputAxisMagnitude: number = currentMoveVector.Magnitude
if inputAxisMagnitude < self.radiusOfDeadZone then
currentMoveVector = ZERO_VECTOR3
else
currentMoveVector = currentMoveVector.Unit*(
1 - math.max(0, (self.radiusOfMaxSpeed - currentMoveVector.Magnitude)/self.radiusOfMaxSpeed)
)
currentMoveVector = Vector3.new(currentMoveVector.X, 0, currentMoveVector.Y)
end
self.moveVector = currentMoveVector
end
function DynamicThumbstick:LayoutMiddleImages(startPos: Vector3, endPos: Vector3)
local startDist = (self.thumbstickSize / 2) + self.middleSize
local vector = endPos - startPos
local distAvailable = vector.Magnitude - (self.thumbstickRingSize / 2) - self.middleSize
local direction = vector.Unit
local distNeeded = self.middleSpacing * NUM_MIDDLE_IMAGES
local spacing = self.middleSpacing
if distNeeded < distAvailable then
spacing = distAvailable / NUM_MIDDLE_IMAGES
end
for i = 1, NUM_MIDDLE_IMAGES do
local image = self.middleImages[i]
local distWithout = startDist + (spacing * (i - 2))
local currentDist = startDist + (spacing * (i - 1))
if distWithout < distAvailable then
local pos = endPos - direction * currentDist
local exposedFraction = math.clamp(1 - ((currentDist - distAvailable) / spacing), 0, 1)
image.Visible = true
image.Position = UDim2.new(0, pos.X, 0, pos.Y)
image.Size = UDim2.new(0, self.middleSize * exposedFraction, 0, self.middleSize * exposedFraction)
else
image.Visible = false
end
end
end
function DynamicThumbstick:MoveStick(pos)
local vector2StartPosition = Vector2.new(self.moveTouchStartPosition.X, self.moveTouchStartPosition.Y)
local startPos = vector2StartPosition - self.thumbstickFrame.AbsolutePosition
local endPos = Vector2.new(pos.X, pos.Y) - self.thumbstickFrame.AbsolutePosition
self.endImage.Position = UDim2.new(0, endPos.X, 0, endPos.Y)
self:LayoutMiddleImages(startPos, endPos)
end
function DynamicThumbstick:BindContextActions()
local function inputBegan(inputObject)
if self.moveTouchObject then
return Enum.ContextActionResult.Pass
end
if not self:InputInFrame(inputObject) then
return Enum.ContextActionResult.Pass
end
if self.isFirstTouch then
self.isFirstTouch = false
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out,0,false,0)
TweenService:Create(self.startImage, tweenInfo, {Size = UDim2.new(0, 0, 0, 0)}):Play()
TweenService:Create(
self.endImage,
tweenInfo,
{Size = UDim2.new(0, self.thumbstickSize, 0, self.thumbstickSize), ImageColor3 = Color3.new(0,0,0)}
):Play()
end
self.moveTouchLockedIn = false
self.moveTouchObject = inputObject
self.moveTouchStartPosition = inputObject.Position
self.moveTouchFirstChanged = true
if FADE_IN_OUT_BACKGROUND then
self:DoFadeInBackground()
end
return Enum.ContextActionResult.Pass
end
local function inputChanged(inputObject: InputObject)
if inputObject == self.moveTouchObject then
if self.moveTouchFirstChanged then
self.moveTouchFirstChanged = false
local startPosVec2 = Vector2.new(
inputObject.Position.X - self.thumbstickFrame.AbsolutePosition.X,
inputObject.Position.Y - self.thumbstickFrame.AbsolutePosition.Y
)
self.startImage.Visible = true
self.startImage.Position = UDim2.new(0, startPosVec2.X, 0, startPosVec2.Y)
self.endImage.Visible = true
self.endImage.Position = self.startImage.Position
self:FadeThumbstick(true)
self:MoveStick(inputObject.Position)
end
self.moveTouchLockedIn = true
local direction = Vector2.new(
inputObject.Position.X - self.moveTouchStartPosition.X,
inputObject.Position.Y - self.moveTouchStartPosition.Y
)
if math.abs(direction.X) > 0 or math.abs(direction.Y) > 0 then
self:DoMove(direction)
self:MoveStick(inputObject.Position)
end
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
local function inputEnded(inputObject)
if inputObject == self.moveTouchObject then
self:OnInputEnded()
if self.moveTouchLockedIn then
return Enum.ContextActionResult.Sink
end
end
return Enum.ContextActionResult.Pass
end
local function handleInput(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
return inputBegan(inputObject)
elseif inputState == Enum.UserInputState.Change then
if FFlagUserDynamicThumbstickMoveOverButtons then
if inputObject == self.moveTouchObject then
return Enum.ContextActionResult.Sink
else
return Enum.ContextActionResult.Pass
end
else
return inputChanged(inputObject)
end
elseif inputState == Enum.UserInputState.End then
return inputEnded(inputObject)
elseif inputState == Enum.UserInputState.Cancel then
self:OnInputEnded()
end
end
ContextActionService:BindActionAtPriority(
DYNAMIC_THUMBSTICK_ACTION_NAME,
handleInput,
false,
DYNAMIC_THUMBSTICK_ACTION_PRIORITY,
Enum.UserInputType.Touch)
if FFlagUserDynamicThumbstickMoveOverButtons then
self.TouchMovedCon = UserInputService.TouchMoved:Connect(function(inputObject: InputObject, _gameProcessedEvent: boolean)
inputChanged(inputObject)
end)
end
end
function DynamicThumbstick:UnbindContextActions()
ContextActionService:UnbindAction(DYNAMIC_THUMBSTICK_ACTION_NAME)
if self.TouchMovedCon then
self.TouchMovedCon:Disconnect()
end
end
function DynamicThumbstick:Create(parentFrame: GuiBase2d)
if self.thumbstickFrame then
self.thumbstickFrame:Destroy()
self.thumbstickFrame = nil
if self.onRenderSteppedConn then
self.onRenderSteppedConn:Disconnect()
self.onRenderSteppedConn = nil
end
end
self.thumbstickSize = 45
self.thumbstickRingSize = 20
self.middleSize = 10
self.middleSpacing = self.middleSize + 4
self.radiusOfDeadZone = 2
self.radiusOfMaxSpeed = 20
local screenSize = parentFrame.AbsoluteSize
local isBigScreen = math.min(screenSize.X, screenSize.Y) > 500
if isBigScreen then
self.thumbstickSize = self.thumbstickSize * 2
self.thumbstickRingSize = self.thumbstickRingSize * 2
self.middleSize = self.middleSize * 2
self.middleSpacing = self.middleSpacing * 2
self.radiusOfDeadZone = self.radiusOfDeadZone * 2
self.radiusOfMaxSpeed = self.radiusOfMaxSpeed * 2
end
local safeInset: number = if FFlagUserDynamicThumbstickSafeAreaUpdate then SAFE_AREA_INSET_MAX else 0
local function layoutThumbstickFrame(portraitMode: boolean)
if portraitMode then
self.thumbstickFrame.Size = UDim2.new(1, safeInset, 0.4, safeInset)
self.thumbstickFrame.Position = UDim2.new(0, -safeInset, 0.6, 0)
else
self.thumbstickFrame.Size = UDim2.new(0.4, safeInset, 2/3, safeInset)
self.thumbstickFrame.Position = UDim2.new(0, -safeInset, 1/3, 0)
end
end
self.thumbstickFrame = Instance.new("Frame")
self.thumbstickFrame.BorderSizePixel = 0
self.thumbstickFrame.Name = "DynamicThumbstickFrame"
self.thumbstickFrame.Visible = false
self.thumbstickFrame.BackgroundTransparency = 1.0
self.thumbstickFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
self.thumbstickFrame.Active = false
layoutThumbstickFrame(false)
self.startImage = Instance.new("ImageLabel")
self.startImage.Name = "ThumbstickStart"
self.startImage.Visible = true
self.startImage.BackgroundTransparency = 1
self.startImage.Image = TOUCH_CONTROLS_SHEET
self.startImage.ImageRectOffset = Vector2.new(1,1)
self.startImage.ImageRectSize = Vector2.new(144, 144)
self.startImage.ImageColor3 = Color3.new(0, 0, 0)
self.startImage.AnchorPoint = Vector2.new(0.5, 0.5)
self.startImage.Position = UDim2.new(0, self.thumbstickRingSize * 3.3 + safeInset, 1, -self.thumbstickRingSize * 2.8 - safeInset)
self.startImage.Size = UDim2.new(0, self.thumbstickRingSize * 3.7, 0, self.thumbstickRingSize * 3.7)
self.startImage.ZIndex = 10
self.startImage.Parent = self.thumbstickFrame
self.endImage = Instance.new("ImageLabel")
self.endImage.Name = "ThumbstickEnd"
self.endImage.Visible = true
self.endImage.BackgroundTransparency = 1
self.endImage.Image = TOUCH_CONTROLS_SHEET
self.endImage.ImageRectOffset = Vector2.new(1,1)
self.endImage.ImageRectSize = Vector2.new(144, 144)
self.endImage.AnchorPoint = Vector2.new(0.5, 0.5)
self.endImage.Position = self.startImage.Position
self.endImage.Size = UDim2.new(0, self.thumbstickSize * 0.8, 0, self.thumbstickSize * 0.8)
self.endImage.ZIndex = 10
self.endImage.Parent = self.thumbstickFrame
for i = 1, NUM_MIDDLE_IMAGES do
self.middleImages[i] = Instance.new("ImageLabel")
self.middleImages[i].Name = "ThumbstickMiddle"
self.middleImages[i].Visible = false
self.middleImages[i].BackgroundTransparency = 1
self.middleImages[i].Image = TOUCH_CONTROLS_SHEET
self.middleImages[i].ImageRectOffset = Vector2.new(1,1)
self.middleImages[i].ImageRectSize = Vector2.new(144, 144)
self.middleImages[i].ImageTransparency = MIDDLE_TRANSPARENCIES[i]
self.middleImages[i].AnchorPoint = Vector2.new(0.5, 0.5)
self.middleImages[i].ZIndex = 9
self.middleImages[i].Parent = self.thumbstickFrame
end
local CameraChangedConn: RBXScriptConnection? = nil
local function onCurrentCameraChanged()
if CameraChangedConn then
CameraChangedConn:Disconnect()
CameraChangedConn = nil
end
local newCamera = workspace.CurrentCamera
if newCamera then
local function onViewportSizeChanged()
local size = newCamera.ViewportSize
local portraitMode = size.X < size.Y
layoutThumbstickFrame(portraitMode)
end
CameraChangedConn = newCamera:GetPropertyChangedSignal("ViewportSize"):Connect(onViewportSizeChanged)
onViewportSizeChanged()
end
end
workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onCurrentCameraChanged)
if workspace.CurrentCamera then
onCurrentCameraChanged()
end
self.moveTouchStartPosition = nil
self.startImageFadeTween = nil
self.endImageFadeTween = nil
self.middleImageFadeTweens = {}
self.onRenderSteppedConn = RunService.RenderStepped:Connect(function()
if self.tweenInAlphaStart ~= nil then
local delta = tick() - self.tweenInAlphaStart
local fadeInTime = (self.fadeInAndOutHalfDuration * 2 * self.fadeInAndOutBalance)
self.thumbstickFrame.BackgroundTransparency = 1 - FADE_IN_OUT_MAX_ALPHA*math.min(delta/fadeInTime, 1)
if delta > fadeInTime then
self.tweenOutAlphaStart = tick()
self.tweenInAlphaStart = nil
end
elseif self.tweenOutAlphaStart ~= nil then
local delta = tick() - self.tweenOutAlphaStart
local fadeOutTime = (self.fadeInAndOutHalfDuration * 2) - (self.fadeInAndOutHalfDuration * 2 * self.fadeInAndOutBalance)
self.thumbstickFrame.BackgroundTransparency = 1 - FADE_IN_OUT_MAX_ALPHA + FADE_IN_OUT_MAX_ALPHA*math.min(delta/fadeOutTime, 1)
if delta > fadeOutTime then
self.tweenOutAlphaStart = nil
end
end
end)
self.onTouchEndedConn = UserInputService.TouchEnded:connect(function(inputObject: InputObject)
if inputObject == self.moveTouchObject then
self:OnInputEnded()
end
end)
GuiService.MenuOpened:connect(function()
if self.moveTouchObject then
self:OnInputEnded()
end
end)
local playerGui = LocalPlayer:FindFirstChildOfClass("PlayerGui")
while not playerGui do
LocalPlayer.ChildAdded:wait()
playerGui = LocalPlayer:FindFirstChildOfClass("PlayerGui")
end
local playerGuiChangedConn = nil
local originalScreenOrientationWasLandscape = playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeLeft or
playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeRight
local function longShowBackground()
self.fadeInAndOutHalfDuration = 2.5
self.fadeInAndOutBalance = 0.05
self.tweenInAlphaStart = tick()
end
playerGuiChangedConn = playerGui:GetPropertyChangedSignal("CurrentScreenOrientation"):Connect(function()
if (originalScreenOrientationWasLandscape and playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.Portrait) or
(not originalScreenOrientationWasLandscape and playerGui.CurrentScreenOrientation ~= Enum.ScreenOrientation.Portrait) then
playerGuiChangedConn:disconnect()
longShowBackground()
if originalScreenOrientationWasLandscape then
self.hasFadedBackgroundInPortrait = true
else
self.hasFadedBackgroundInLandscape = true
end
end
end)
self.thumbstickFrame.Parent = parentFrame
if game:IsLoaded() then
longShowBackground()
else
coroutine.wrap(function()
game.Loaded:Wait()
longShowBackground()
end)()
end
end
return DynamicThumbstick
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Cocoa",Paint)
end)
|
--Values--
|
local car = script.Parent.Parent.Car.Value
local FE = workspace.FilteringEnabled
local _Tune = require(car["A-Chassis Tune"])
local Redline = _Tune.Redline
local maxPSI = WasteGatePressure
local totalPSI = 0
local actualPSI = 0
local CR = CompressionRatio
local TC = TurboCount
local handler = car:WaitForChild("UpdateAndMake")
local Values = script.Parent.Parent.Values
local Throttle = script.Parent.Parent.Values.Throttle.Value
local BOVFix = (1 - Throttle)
local tester = 1
local BOVact = 0
local BOVact2 = 0
local Whistle = car.DriveSeat:WaitForChild("Whistle")
local BOV = car.DriveSeat:WaitForChild("BOV")
Whistle:Play()
script.Parent.Parent.Values.RPM.Changed:connect(function()
--When In Neutral
if Values.Horsepower.Value == 0 then
totalPSI = totalPSI + ((((((Values.RPM.Value*(Values.Throttle.Value*1.2)/Redline)/8.5)-(((totalPSI/WasteGatePressure*(WasteGatePressure/15)))))*((36/TurboSize)*2))/WasteGatePressure)*15)
if totalPSI < 0.05 then
totalPSI = 0.05
end
if totalPSI > 2 then
totalPSI = 2
end
--TEST
end
--When Driving
if Values.Horsepower.Value > 0 then
totalPSI = totalPSI + ((((((Values.Horsepower.Value*(Values.Throttle.Value*1.2)/_Tune.Horsepower)/8)+(0.028-((totalPSI/WasteGatePressure*(WasteGatePressure/15))*1.2)))*((36/TurboSize)*2))/WasteGatePressure)*15)
if totalPSI < 0.05 then
totalPSI = 0.05
end
if totalPSI > 2 then
totalPSI = 2
end
--TEST
end
actualPSI = totalPSI/2
if FE then
local BP = totalPSI
handler:FireServer(totalPSI,actualPSI,Throttle,BOVFix,BOV_Loudness,TurboLoudness,BOV_Pitch)
else
local Throttle2 = Throttle
local W = car.DriveSeat:WaitForChild("Whistle")
local B = car.DriveSeat:WaitForChild("BOV")
local bvol = B.Volume
if Throttle2 < 0 then
Throttle2 = 0
end
W.Pitch = (totalPSI)
W.Volume = (totalPSI/4)*TurboLoudness
B.Pitch = (1 - (-totalPSI/20))*BOV_Pitch
B.Volume = (((-0.5+((totalPSI/2)*BOV_Loudness)))*(1 - script.Parent.Parent.Values.Throttle.Value))
end
end)
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Brown",Paint)
end)
|
--[[if JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Thumbnail")then]]--
--[[JeffTheKiller:FindFirstChild("Thumbnail"):Destroy();]]--
--[[end;]]
|
--
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local AttackDebounce=false;
local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Knife");
local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head");
local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart");
local WalkDebounce=false;
local Notice=false;
local JeffLaughDebounce=false;
local MusicDebounce=false;
local NoticeDebounce=false;
local ChosenMusic;
function FindNearestBae()
local NoticeDistance=100;
local TargetMain;
for _,TargetModel in pairs(Game:GetService("Workspace"):GetChildren())do
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("HumanoidRootPart")and TargetModel:FindFirstChild("Head")then
local TargetPart=TargetModel:FindFirstChild("HumanoidRootPart");
local FoundHumanoid;
for _,Child in pairs(TargetModel:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then
TargetMain=TargetPart;
NoticeDistance=(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude;
local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).unit,500)
if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("HumanoidRootPart")and hit.Parent:FindFirstChild("Head")then
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<9 and not AttackDebounce then
Spawn(function()
AttackDebounce=true;
local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("Swing"));
local SwingChoice=math.random(1,2);
local HitChoice=math.random(1,3);
SwingAnimation:Play();
SwingAnimation:AdjustSpeed(1.5+(math.random()*0.1));
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Swing")then
local SwingSound=JeffTheKillerKnife:FindFirstChild("Swing");
SwingSound.Pitch=1+(math.random()*0.04);
SwingSound:Play();
end;
Wait(0.3);
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then
FoundHumanoid:TakeDamage(5000);
if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit1")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit1");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit2")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit2");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit3")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit3");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
end;
end;
Wait(0.1);
AttackDebounce=false;
end);
end;
end;
end;
end;
end;
return TargetMain;
end;
while Wait(0)do
local TargetPoint=JeffTheKillerHumanoid.TargetPoint;
local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRootPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector,(JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller})
local Jumpable=false;
if Blockage then
Jumpable=true;
if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then
local BlockageHumanoid;
for _,Child in pairs(Blockage.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
BlockageHumanoid=Child;
end;
end;
if Blockage and Blockage:IsA("Terrain")then
local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0)));
local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos.Z);
if CellMaterial==Enum.CellMaterial.Water then
Jumpable=false;
end;
elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool"then
Jumpable=false;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then
JeffTheKillerHumanoid.Jump=true;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("Jeff_Step")and (JeffTheKillerHumanoidRootPart.Velocity-Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
Spawn(function()
WalkDebounce=true;
local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0));
local RayTarget,endPoint=Game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKiller);
if RayTarget then
local JeffTheKillerHeadFootStepClone=JeffTheKillerHead:FindFirstChild("Jeff_Step"):Clone();
JeffTheKillerHeadFootStepClone.Parent=JeffTheKillerHead;
JeffTheKillerHeadFootStepClone:Play();
JeffTheKillerHeadFootStepClone:Destroy();
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<17 then
Wait(0.5);
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>17 then
Wait(0.2);
end
end;
WalkDebounce=false;
end);
end;
local MainTarget=FindNearestBae();
local FoundHumanoid;
if MainTarget then
for _,Child in pairs(MainTarget.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and MainTarget.Parent and FoundHumanoid and FoundHumanoid.Jump then
JeffTheKillerHumanoid.Jump=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and not JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=1;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
if not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
end;
end;
if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<50 then
local MusicChoice=math.random(1,2);
if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1");
elseif MusicChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2");
end;
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then
ChosenMusic.Volume=0.5;
ChosenMusic:Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>50 then
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then
if not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
end;
end;
if not MainTarget and not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
if not MainTarget and not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
if MainTarget then
Notice=true;
if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Susto2")then
JeffTheKillerHead:FindFirstChild("Jeff_Susto2"):Play();
NoticeDebounce=true;
end
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then
JeffTheKillerHumanoid.WalkSpeed=28;
elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then
JeffTheKillerHumanoid.WalkSpeed=0.004;
end;
JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).unit*2,Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
else
Notice=false;
NoticeDebounce=false;
local RandomWalk=math.random(1,150);
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
JeffTheKillerHumanoid.WalkSpeed=12;
if RandomWalk==1 then
JeffTheKillerHumanoid:MoveTo(Game:GetService("Workspace"):FindFirstChild("Terrain").Position+Vector3.new(math.random(-2048,2048),0,math.random(-2048,2048)),Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.DisplayDistanceType="None";
JeffTheKillerHumanoid.HealthDisplayDistance=0;
JeffTheKillerHumanoid.Name="ColdBloodedKiller";
JeffTheKillerHumanoid.NameDisplayDistance=0;
JeffTheKillerHumanoid.NameOcclusion="EnemyOcclusion";
JeffTheKillerHumanoid.AutoJumpEnabled=true;
JeffTheKillerHumanoid.AutoRotate=true;
JeffTheKillerHumanoid.MaxHealth=2000;
JeffTheKillerHumanoid.JumpPower=60;
JeffTheKillerHumanoid.MaxSlopeAngle=89.9;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then
JeffTheKillerHumanoid.AutoJumpEnabled=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then
JeffTheKillerHumanoid.AutoRotate=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then
JeffTheKillerHumanoid.PlatformStand=false;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then
JeffTheKillerHumanoid.Sit=false;
end;
end;
|
-- подключаем к игроку
|
game.Players.PlayerAdded:Connect(onPlayerJoin)
|
--thank to Sinahi for making the beautiful flag!
--https://www.roblox.com/Wavin-Flag-item?id=440874100
|
local rbx='rbxassetid://'
local flagids={
440821546,440821646,440821766,440822311,
440823132,440823493,440823602,440823734,
440823940,440824067,440824314,440824941,
440825077,440825340,440825848,440826132} --this is all the mesh ids in one table, in order
local texture=0--asset id here
local flagmesh=script.Parent.Flag.Mesh flagmesh.TextureId=rbx..texture
local n=1 repeat for i,v in next,flagids do wait() flagmesh.MeshId=rbx..v end n=n+1 if n>=#flagids then n=1 else end until nil
|
-- ROBLOX MOVED: expect/jasmineUtils.lua
|
local function isA(typeName: string, value: any)
return getType(value) == typeName
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.