prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Set up the click event handlers for each button
|
for _, button in ipairs(dock:GetChildren()) do
if button:IsA("ImageButton") then
local appName = button.AppName
appName.Visible = false
button.MouseEnter:Connect(function()
-- Show the AppName frame
appName.Visible = true
end)
button.MouseLeave:Connect(function()
-- Hide the AppName frame
appName.Visible = false
end)
end
end
|
--[[Weight and CG]]
|
Tune.Weight = 700 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 4 ,
--[[Length]] 14 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .0 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
-------AGAIN
|
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l11.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(21)
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--------------------[ HIT HANDLING FUNCTIONS ]----------------------------------------
|
function Damage(HitObj, HitPos)
local HeadVal = S.Multipliers.Head
local ChestVal = S.Multipliers.Chest
local LimbsVal = S.Multipliers.Limbs
if Humanoid.Health ~= 0 then
if HitObj and HitObj.Parent then
local HumanoidFound = false
local HitHumanoid = nil
if HitObj.Parent.ClassName == "Hat" then
if FindFirstClass(HitObj.Parent.Parent, "Humanoid") then
HitHumanoid = FindFirstClass(HitObj.Parent.Parent, "Humanoid")
HumanoidFound = true
if HitHumanoid.Health > 0 then
if IsEnemy(HitHumanoid) then
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Value = Player
CreatorTag.Name = "creator"
CreatorTag.Parent = HitHumanoid
HitHumanoid:TakeDamage(S.Damage * RAND(HeadVal, HeadVal + 0.1, 0.01))
MarkHit()
end
end
end
else
if FindFirstClass(HitObj.Parent, "Humanoid") then
HitHumanoid = FindFirstClass(HitObj.Parent, "Humanoid")
HumanoidFound = true
if HitHumanoid.Health > 0 then
if IsEnemy(HitHumanoid) then
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Value = Player
CreatorTag.Name = "creator"
CreatorTag.Parent = HitHumanoid
local ChosenDamage = 0
if HitObj.Name == "Head" then
ChosenDamage = S.Damage * RAND(HeadVal, HeadVal + 0.1, 0.01)
elseif HitObj.Name == "Torso" then
ChosenDamage = S.Damage * RAND(ChestVal, ChestVal + 0.1, 0.01)
else
ChosenDamage = S.Damage * RAND(LimbsVal, LimbsVal + 0.1, 0.01)
end
HitHumanoid:TakeDamage(ChosenDamage)
MarkHit()
end
end
end
end
if (not HumanoidFound) then
if S.BulletHoles then
CreateBulletHole(HitPos, HitObj)
end
if S.Shockwaves then
CreateShockwave(HitPos, S.ShockwaveRadius)
end
end
return HitHumanoid
end
end
end
function PenetrateWall(HitPos, Direction, HitHumanoid, OriginPos, Bullet)
local HitDist = (HitPos - OriginPos).magnitude
local Thickness, Wall, WallHitPos = 0, nil, nil
for i = 0.1, S.Penetration, 0.1 do
local WallRay = Ray.new(HitPos + (Direction * i), -Direction)
local TempWall, TempWallHitPos = game.Workspace:FindPartOnRayWithIgnoreList(WallRay, Ignore)
if TempWall then
Thickness = i
Wall, WallHitPos = TempWall, TempWallHitPos
break
end
end
if Wall then
CreateBulletHole(WallHitPos, Wall)
if S.InstantHit then
local HitObj2, HitPos2 = nil, nil
if HitHumanoid then
HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist, {HitHumanoid.Parent,unpack(Ignore)})
else
HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist)
end
Damage(HitObj2, HitPos2)
return HitPos2
else
local LastPos = WallHitPos
local TotalDistTraveled = 0
spawn(function()
while true do
RS:wait()
if TotalDistTraveled >= S.BulletRange - HitDist then
Bullet:Destroy()
break
end
local DistTraveled = (Bullet.Position - LastPos).magnitude
local NewDirection = (Bullet.Position - LastPos).unit
local TempHitObj, TempHitPos = nil, nil
if HitHumanoid then
TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled, {HitHumanoid.Parent,unpack(Ignore)})
else
TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled)
end
if TempHitObj then
Damage(TempHitObj, TempHitPos)
Bullet:Destroy()
return TempHitPos
else
LastPos = Bullet.Position
TotalDistTraveled = TotalDistTraveled + DistTraveled
end
end
end)
end
else
if Bullet then Bullet:Destroy() end
return HitPos
end
end
function IsEnemy(Human)
local Plyr = game.Players:GetPlayerFromCharacter(Human.Parent)
if (not Plyr) then return S.CanDamageNPCs end
return S.AllowFriendlyFire or (Plyr.TeamColor ~= Player.TeamColor or Plyr.Neutral)
end
|
-- << BANLAND >>
|
local banlandDe = true
function module:CreateBanland()
coroutine.wrap(function()
if not banlandDe then
return
else
banlandDe = false
end
local totalY = 0
if main.pdata.Rank < main.settings.ViewBanland then
main:GetModule("cf"):ClearPage(pages.banland)
local label = templates.banTitle:Clone()
label.BackgroundColor3 = Color3.fromRGB(95, 95, 95)
label.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
label.TextLabel.Text = "Must be rank '".. main:GetModule("cf"):GetRankName(main.settings.ViewBanland).."' or higher to view the Banland"
label.Name = "TitleLabel"
label.Visible = true
label.Parent = pages.banland
else
--Retrieve Info
local banlandInfo = main.signals.RetrieveBanland:InvokeServer()
local canModifyBans = false
if main.pdata.Rank >= (main.commandRanks.directban or 4) then
canModifyBans = true
end
--Clear labels
main:GetModule("cf"):ClearPage(pages.banland)
--Setup Labels
local sectionNames = {"Current Server", "All Servers"}
for section, records in pairs(banlandInfo) do
--
if #records > 0 then
local label = templates.banTitle:Clone()
label.BackgroundColor3 = Color3.fromRGB(95, 95, 95)
label.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
label.TextLabel.Text = sectionNames[section]
label.Name = "TitleLabel"
totalY = totalY + templates.banTitle.AbsoluteSize.Y
label.Visible = true
label.Parent = pages.banland
end
--
for i, record in pairs(records) do
local userId = record.UserId
if userId > 0 then
totalY = totalY + templates.ban.AbsoluteSize.Y
local settingsBan = record.SettingsBan
local label = templates.ban:Clone()
label.Name = "BanLabel"
label.PlrName.Text = main:GetModule("cf"):GetName(userId)
local banDateString
local banTime = record.BanTime
if tonumber(banTime) then
banDateString = main:GetModule("cf"):GetBanDateString(os.date("*t", banTime))
elseif settingsBan then
banDateString = "Auto Settings Ban"
else
banDateString = "Infinite"
end
label.BanLength.Text = banDateString
label.PlayerImage.Image = main:GetModule("cf"):GetUserImage(userId)
label.BackgroundColor3 = main:GetModule("cf"):GetLabelBackgroundColor(i)
local viewMore = label.ViewMore
if canModifyBans and not settingsBan then
viewMore.Visible = true
viewMore.MouseButton1Down:Connect(function()
main:GetModule("cf"):ShowBannedUser{label.PlrName.Text, userId, record.Reason, record.BannedBy}
end)
else
viewMore.Visible = false
end
label.Visible = true
label.Parent = pages.banland
end
end
end
end
--Canvas Size
pages.banland.CanvasSize = UDim2.new(0, 0, 0, totalY)
banlandDe = true
end)()
end
function module:UpdatePages()
module:CreateServerRanks()
module:CreateBanland()
module:CreateRanks()
end
|
---------------
-- Variables --
---------------
|
local RunService = game:GetService('RunService')
local PlayersService = game:GetService('Players')
local Player = PlayersService.LocalPlayer
local Camera = nil
local Character = nil
local Torso = nil
local Mode = nil
local BehaviorFunction = nil
local childAddedConn = nil
local childRemovedConn = nil
local Behaviors = {} -- Map of modes to behavior fns
local SavedHits = {} -- Objects currently being faded in/out
local TrackedLimbs = {} -- Used in limb-tracking casting modes
|
--
|
for i = 1, 50 do
wait(.1)
bar.ImageTransparency = i/20+0.2
end
bar:Destroy()
|
--Internal functions
|
function DataStore:Debug(...)
if self.debug then
--print("[DataStore2.Debug]", ...)
end
end
function DataStore:_GetRaw()
if self.getRawPromise then
return self.getRawPromise
end
self.getRawPromise = self.savingMethod:Get():andThen(function(value)
self.value = value
self:Debug("value received")
self.haveValue = true
self.getting = false
end):catch(function(reason)
self.getting = false
self.getRawPromise = nil
return Promise.reject(reason)
end)
return self.getRawPromise
end
function DataStore:_Update(dontCallOnUpdate)
if not dontCallOnUpdate then
for _, callback in ipairs(self.callbacks) do
callback(self.value, self)
end
end
self.haveValue = true
self.valueUpdated = true
end
|
--
-- THESE ARE THE CORE SETTINGS
-- YOU WILL NOT BE ABLE TO CHANGE THEM IN-GAME
|
local Settings={
--[[
Style Options
������������� ]]
Flat=false; -- Enables Flat theme / Disables Aero theme
ForcedColor=false; -- Forces everyone to have set color & transparency
Color=Color3.new(0,0,0); -- Changes the Color of the user interface
ColorTransparency=.75; -- Changes the Transparency of the user interface
Chat=false; -- Enables the custom chat
BubbleChat=false; -- Enables the custom bubble chat
--[[
Basic Settings
�������������� ]]
AdminCredit=true; -- Enables the credit GUI for that appears in the bottom right
AutoClean=false; -- Enables automatic cleaning of hats & tools in the Workspace
AutoCleanDelay=60; -- The delay between each AutoClean routine
CommandBar=true; -- Enables the Command Bar | GLOBAL KEYBIND: \
FunCommands=true; -- Enables fun yet unnecessary commands
FreeAdmin=true; -- Set to 1-5 to grant admin powers to all, otherwise set to false
PublicLogs=false; -- Allows all users to see the command & chat logs
Prefix=':'; -- Character to begin a command
--[[
Admin Powers
������������
0 Player
1 VIP Can use nonabusive commands only on self
2 Moderator Can kick, mute, & use most commands
3 Administrator Can ban, crash, & set Moderators/VIP
4 SuperAdmin Can grant permanent powers, & shutdown the game
5 Owner Can set SuperAdmins, & use all the commands
6 Game Creator Can set owners & use all the commands
Group & VIP Admin
�����������������
You can set multiple Groups & Ranks to grant users admin powers
GroupAdmin={
[12345]={[254]=4,[253]=3};
[GROUPID]={[RANK]=ADMINPOWER}
};
You can set multiple Assets to grant users admin powers
VIPAdmin={
[12345]=3;
[54321]=4;
[ITEMID]=ADMINPOWER;
}; ]]
GroupAdmin={
};
VIPAdmin={
};
--[[
Permissions
�����������
-- You can set the admin power required to use a command
-- COMMANDNAME=ADMINPOWER; ]]
Permissions={
};
}
return {Settings,{Owners,SuperAdmins,Admins,Mods,VIP,Banned}}
|
--// UI Tween Info
|
local L_166_ = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local L_167_ = {
TextTransparency = 1
}
|
-- Advanced example, using promises to get points:
|
PointsService:GetPointsPromise():Then(function(points)
print("Got points:", points)
end)
Knit.Start():Then(function()
print("Knit running")
end):Catch(function(err)
warn(err)
end)
wait(3)
CameraController:LockTo(workspace.SpawnLocation)
wait(6)
CameraController:Unlock()
|
--Updates the tach
|
val.RPM.Changed:connect(function()
Guages.RPM.Text = tostring(math.floor(val.RPM.Value))
--Updates the RPM Lights
local LightFraction = tostring(math.ceil(math.max(((val.RPM.Value - BeginRPM) / (MaxRPM - BeginRPM)) * 15,0)))
print(LightFraction)
Guages.RPM_LIGHTS[LightFraction].Visible = true
for i = 1,15 do
if tonumber(Guages.RPM_LIGHTS[i].Name) > tonumber(LightFraction)then
Guages.RPM_LIGHTS[i].Visible = false
end
end
end)
|
--[[
Changelog:
- Add ExtraData and Attachments to gun instance data
]]
|
return function(Data)
for _, Gun in pairs(Data.OwnedGuns) do
if (not Gun.ExtraData) then
Gun.ExtraData = {
Attachments = {};
XP = 0;
}
end
end
end
|
-- Set up the Local Player
|
if RunService:IsClient() then
if LocalPlayer.Character then
onCharacterAdded(LocalPlayer.Character)
end
LocalPlayer.CharacterAdded:Connect(onCharacterAdded)
LocalPlayer.CharacterRemoving:Connect(onCharacterRemoving)
end
local ShoulderCamera = {}
ShoulderCamera.__index = ShoulderCamera
ShoulderCamera.SpringService = nil
function ShoulderCamera.new(weaponsSystem)
local self = setmetatable({}, ShoulderCamera)
self.weaponsSystem = weaponsSystem
-- Configuration parameters (constants)
self.fieldOfView = 70
self.minPitch = math.rad(-75) -- min degrees camera can angle down
self.maxPitch = math.rad(75) -- max degrees camera can cangle up
self.normalOffset = Vector3.new(.5, 2, -0.5) -- this is the camera's offset from the player
self.zoomedOffsetDistance = 8 -- number of studs to zoom in from default offset when zooming
self.normalCrosshairScale = 1
self.zoomedCrosshairScale = 0.75
self.defaultZoomFactor = 1
self.canZoom = true
self.zoomInputs = { Enum.UserInputType.MouseButton2, Enum.KeyCode.ButtonL2 }
self.sprintInputs = { Enum.KeyCode.LeftShift }
self.mouseRadsPerPixel = Vector2.new(1 / 480, 1 / 480)
self.zoomedMouseRadsPerPixel = Vector2.new(1 / 1200, 1 / 1200)
self.touchSensitivity = Vector2.new(1 / 100, 1 / 100)
self.zoomedTouchSensitivity = Vector2.new(1 / 200, 1 / 200)
self.touchDelayTime = 0.25 -- max time for a touch to count as a tap (to shoot the weapon instead of control camera),
-- also the amount of time players have to start a second touch after releasing the first time to trigger automatic fire
self.recoilDecay = 2 -- higher number means faster recoil decay rate
self.rotateCharacterWithCamera = true
self.gamepadSensitivityModifier = Vector2.new(0.85, 0.65)
-- Walk speeds
self.zoomWalkSpeed = 8
self.normalWalkSpeed = 16
self.sprintingWalkSpeed = 24
-- Current state
self.enabled = false
self.yaw = 0
self.pitch = 0
self.currentCFrame = CFrame.new()
self.currentOffset = self.normalOffset
self.currentRecoil = Vector2.new(0, 0)
self.currentMouseRadsPerPixel = self.mouseRadsPerPixel
self.currentTouchSensitivity = self.touchSensitivity
self.mouseLocked = true
self.touchPanAccumulator = Vector2.new(0, 0) -- used for touch devices, represents amount the player has dragged their finger since starting a touch
self.currentTool = nil
self.sprintingInputActivated = false
self.desiredWalkSpeed = self.normalWalkSpeed
self.sprintEnabled = false -- true means player will move faster while doing sprint inputs
self.slowZoomWalkEnabled = false -- true means player will move slower while doing zoom inputs
self.desiredFieldOfView = self.fieldOfView
-- Zoom variables
self.zoomedFromInput = false -- true if player has performed input to zoom
self.forcedZoomed = false -- ignores zoomedFromInput and canZoom
self.zoomState = false -- true if player is currently zoomed in
self.zoomAlpha = 0
self.hasScope = false
self.hideToolWhileZoomed = false
self.currentZoomFactor = self.defaultZoomFactor
self.zoomedFOV = self.fieldOfView
-- Gamepad variables
self.gamepadPan = Vector2.new(0, 0) -- essentially the amount the gamepad has moved from resting position
self.movementPan = Vector2.new(0, 0) -- this is for movement (gamepadPan is for camera)
self.lastThumbstickPos = Vector2.new(0, 0)
self.lastThumbstickTime = nil
self.currentGamepadSpeed = 0
self.lastGamepadVelocity = Vector2.new(0, 0)
-- Occlusion
self.lastOcclusionDistance = 0
self.lastOcclusionReachedTime = 0 -- marks the last time camera was at the true occlusion distance
self.defaultTimeUntilZoomOut = 0
self.timeUntilZoomOut = self.defaultTimeUntilZoomOut -- time after lastOcclusionReachedTime that camera will zoom out
self.timeLastPoppedWayIn = 0 -- this holds the last time camera popped nearly into first person
self.isZoomingOut = false
self.tweenOutTime = 0.2
self.curOcclusionTween = nil
self.occlusionTweenObject = nil
-- Side correction (when player is against a wall)
self.sideCorrectionGoalVector = nil
self.lastSideCorrectionMagnitude = 0
self.lastSideCorrectionReachedTime = 0 -- marks the last time the camera was at the true correction distance
self.revertSideCorrectionSpeedMultiplier = 2 -- speed at which camera reverts the side correction (towards 0 correction)
self.defaultTimeUntilRevertSideCorrection = 0.75
self.timeUntilRevertSideCorrection = self.defaultTimeUntilRevertSideCorrection -- time after lastSideCorrectionReachedTime that camera will revert the correction
self.isRevertingSideCorrection = false
-- Datamodel references
self.eventConnections = {}
self.raycastIgnoreList = {}
self.currentCamera = nil
self.currentCharacter = nil
self.currentHumanoid = nil
self.currentRootPart = nil
self.controlModule = nil -- used to get player's touch input for moving character
self.random = Random.new()
return self
end
function ShoulderCamera:setEnabled(enabled)
if self.enabled == enabled then
return
end
self.enabled = enabled
if self.enabled then
RunService:BindToRenderStep(CAMERA_RENDERSTEP_NAME, Enum.RenderPriority.Camera.Value - 1, function(dt) self:onRenderStep(dt) end)
ContextActionService:BindAction(ZOOM_ACTION_NAME, function(...) self:onZoomAction(...) end, false, unpack(self.zoomInputs))
ContextActionService:BindAction(SPRINT_ACTION_NAME, function(...) self:onSprintAction(...) end, false, unpack(self.sprintInputs))
table.insert(self.eventConnections, LocalPlayer.CharacterAdded:Connect(function(character) self:onCurrentCharacterChanged(character) end))
table.insert(self.eventConnections, LocalPlayer.CharacterRemoving:Connect(function() self:onCurrentCharacterChanged(nil) end))
table.insert(self.eventConnections, workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function() self:onCurrentCameraChanged(workspace.CurrentCamera) end))
table.insert(self.eventConnections, UserInputService.InputBegan:Connect(function(inputObj, wasProcessed) self:onInputBegan(inputObj, wasProcessed) end))
table.insert(self.eventConnections, UserInputService.InputChanged:Connect(function(inputObj, wasProcessed) self:onInputChanged(inputObj, wasProcessed) end))
table.insert(self.eventConnections, UserInputService.InputEnded:Connect(function(inputObj, wasProcessed) self:onInputEnded(inputObj, wasProcessed) end))
self:onCurrentCharacterChanged(LocalPlayer.Character)
self:onCurrentCameraChanged(workspace.CurrentCamera)
-- Make transition to shouldercamera smooth by facing in same direction as previous camera
local cameraLook = self.currentCamera.CFrame.lookVector
self.yaw = math.atan2(-cameraLook.X, -cameraLook.Z)
self.pitch = math.asin(cameraLook.Y)
self.currentCamera.CameraType = Enum.CameraType.Scriptable
self:setZoomFactor(self.currentZoomFactor) -- this ensures that zoomedFOV reflecs currentZoomFactor
workspace.CurrentCamera.CameraSubject = self.currentRootPart
self.occlusionTweenObject = Instance.new("NumberValue")
self.occlusionTweenObject.Name = "OcclusionTweenObject"
self.occlusionTweenObject.Parent = script
self.occlusionTweenObject.Changed:Connect(function(value)
self.lastOcclusionDistance = value
end)
-- Sets up weapon system to use camera for raycast direction instead of gun look vector
self.weaponsSystem.aimRayCallback = function()
local cameraCFrame = self.currentCFrame
return Ray.new(cameraCFrame.p, cameraCFrame.LookVector * 500)
end
else
RunService:UnbindFromRenderStep(CAMERA_RENDERSTEP_NAME)
ContextActionService:UnbindAction(ZOOM_ACTION_NAME)
ContextActionService:UnbindAction(SPRINT_ACTION_NAME)
if self.currentHumanoid then
self.currentHumanoid.AutoRotate = true
end
if self.currentCamera then
self.currentCamera.CameraType = Enum.CameraType.Custom
end
self:updateZoomState()
self.yaw = 0
self.pitch = 0
for _, conn in pairs(self.eventConnections) do
conn:Disconnect()
end
self.eventConnections = {}
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
UserInputService.MouseIconEnabled = true
end
end
function ShoulderCamera:onRenderStep(dt)
if not self.enabled or
not self.currentCamera or
not self.currentCharacter or
not self.currentHumanoid or
not self.currentRootPart
then
return
end
-- Hide mouse and lock to center if applicable
if self.mouseLocked and not GuiService:GetEmotesMenuOpen() then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
UserInputService.MouseIconEnabled = false
else
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
UserInputService.MouseIconEnabled = true
end
-- Handle gamepad input
self:processGamepadInput(dt)
-- Smoothly zoom to desired values
if self.hasScope then
ShoulderCamera.SpringService:Target(self, 0.8, 8, { zoomAlpha = self.zoomState and 1 or 0 })
ShoulderCamera.SpringService:Target(self.currentCamera, 0.8, 8, { FieldOfView = self.desiredFieldOfView })
else
ShoulderCamera.SpringService:Target(self, 0.8, 3, { zoomAlpha = self.zoomState and 1 or 0 })
ShoulderCamera.SpringService:Target(self.currentCamera, 0.8, 3, { FieldOfView = self.desiredFieldOfView })
end
-- Handle walk speed changes
if self.sprintEnabled or self.slowZoomWalkEnabled then
self.desiredWalkSpeed = self.normalWalkSpeed
if self.sprintEnabled and (self.sprintingInputActivated or self:sprintFromTouchInput() or self:sprintFromGamepadInput()) and not self.zoomState then
self.desiredWalkSpeed = self.sprintingWalkSpeed
end
if self.slowZoomWalkEnabled and self.zoomAlpha > 0.1 then
self.desiredWalkSpeed = self.zoomWalkSpeed
end
ShoulderCamera.SpringService:Target(self.currentHumanoid, 0.95, 4, { WalkSpeed = self.desiredWalkSpeed })
end
-- Initialize variables used for side correction, occlusion, and calculating camera focus/rotation
local rootPartPos = self.currentRootPart.CFrame.Position
local rootPartUnrotatedCFrame = CFrame.new(rootPartPos)
local yawRotation = CFrame.Angles(0, self.yaw, 0)
local pitchRotation = CFrame.Angles(self.pitch + self.currentRecoil.Y, 0, 0)
local xOffset = CFrame.new(self.normalOffset.X, 0, 0)
local yOffset = CFrame.new(0, self.normalOffset.Y, 0)
local zOffset = CFrame.new(0, 0, self.normalOffset.Z)
local collisionRadius = self:getCollisionRadius()
local cameraYawRotationAndXOffset =
yawRotation * -- First rotate around the Y axis (look left/right)
xOffset -- Then perform the desired offset (so camera is centered to side of player instead of directly on player)
local cameraFocus = rootPartUnrotatedCFrame * cameraYawRotationAndXOffset
-- Handle/Calculate side correction when player is adjacent to a wall (so camera doesn't go in the wall)
local vecToFocus = cameraFocus.p - rootPartPos
local rayToFocus = Ray.new(rootPartPos, vecToFocus + (vecToFocus.Unit * collisionRadius))
local hitPart, hitPoint, hitNormal = self:penetrateCast(rayToFocus, self.raycastIgnoreList)
local currentTime = tick()
local sideCorrectionGoalVector = Vector3.new() -- if nothing is adjacent to player, goal vector is (0, 0, 0)
if hitPart then
hitPoint = hitPoint + (hitNormal * collisionRadius)
sideCorrectionGoalVector = hitPoint - cameraFocus.p
if sideCorrectionGoalVector.Magnitude >= self.lastSideCorrectionMagnitude then -- make it easy for camera to pop closer to player (move left)
if currentTime > self.lastSideCorrectionReachedTime + self.timeUntilRevertSideCorrection and self.lastSideCorrectionMagnitude ~= 0 then
self.timeUntilRevertSideCorrection = self.defaultTimeUntilRevertSideCorrection * 2 -- double time until revert if popping in repeatedly
elseif self.lastSideCorrectionMagnitude == 0 and self.timeUntilRevertSideCorrection ~= self.defaultTimeUntilRevertSideCorrection then
self.timeUntilRevertSideCorrection = self.defaultTimeUntilRevertSideCorrection
end
self.lastSideCorrectionMagnitude = sideCorrectionGoalVector.Magnitude
self.lastSideCorrectionReachedTime = currentTime
self.isRevertingSideCorrection = false
else
self.isRevertingSideCorrection = true
end
elseif self.lastSideCorrectionMagnitude ~= 0 then
self.isRevertingSideCorrection = true
end
if self.isRevertingSideCorrection then -- make it hard/slow for camera to revert side correction (move right)
if sideCorrectionGoalVector.Magnitude > self.lastSideCorrectionMagnitude - 1 and sideCorrectionGoalVector.Magnitude ~= 0 then
self.lastSideCorrectionReachedTime = currentTime -- reset timer if occlusion significantly increased since last frame
end
if currentTime > self.lastSideCorrectionReachedTime + self.timeUntilRevertSideCorrection then
local sideCorrectionChangeAmount = dt * (vecToFocus.Magnitude) * self.revertSideCorrectionSpeedMultiplier
self.lastSideCorrectionMagnitude = self.lastSideCorrectionMagnitude - sideCorrectionChangeAmount
if sideCorrectionGoalVector.Magnitude >= self.lastSideCorrectionMagnitude then
self.lastSideCorrectionMagnitude = sideCorrectionGoalVector.Magnitude
self.lastSideCorrectionReachedTime = currentTime
self.isRevertingSideCorrection = false
end
end
end
-- Update cameraFocus to reflect side correction
cameraYawRotationAndXOffset = cameraYawRotationAndXOffset + (-vecToFocus.Unit * self.lastSideCorrectionMagnitude)
cameraFocus = rootPartUnrotatedCFrame * cameraYawRotationAndXOffset
self.currentCamera.Focus = cameraFocus
-- Calculate and apply CFrame for camera
local cameraCFrameInSubjectSpace =
cameraYawRotationAndXOffset *
pitchRotation * -- rotate around the X axis (look up/down)
yOffset * -- move camera up/vertically
zOffset -- move camera back
self.currentCFrame = rootPartUnrotatedCFrame * cameraCFrameInSubjectSpace
-- Move camera forward if zoomed in
if self.zoomAlpha > 0 then
local trueZoomedOffset = math.max(self.zoomedOffsetDistance - self.lastOcclusionDistance, 0) -- don't zoom too far in if already occluded
self.currentCFrame = self.currentCFrame:lerp(self.currentCFrame + trueZoomedOffset * self.currentCFrame.LookVector.Unit, self.zoomAlpha)
end
self.currentCamera.CFrame = self.currentCFrame
-- Handle occlusion
local occlusionDistance = self.currentCamera:GetLargestCutoffDistance(self.raycastIgnoreList)
if occlusionDistance > 1e-5 then
occlusionDistance = occlusionDistance + collisionRadius
end
if occlusionDistance >= self.lastOcclusionDistance then -- make it easy for the camera to pop in towards the player
if self.curOcclusionTween ~= nil then
self.curOcclusionTween:Cancel()
self.curOcclusionTween = nil
end
if currentTime > self.lastOcclusionReachedTime + self.timeUntilZoomOut and self.lastOcclusionDistance ~= 0 then
self.timeUntilZoomOut = self.defaultTimeUntilZoomOut * 2 -- double time until zoom out if popping in repeatedly
elseif self.lastOcclusionDistance == 0 and self.timeUntilZoomOut ~= self.defaultTimeUntilZoomOut then
self.timeUntilZoomOut = self.defaultTimeUntilZoomOut
end
if occlusionDistance / self.normalOffset.Z > 0.8 and self.timeLastPoppedWayIn == 0 then
self.timeLastPoppedWayIn = currentTime
end
self.lastOcclusionDistance = occlusionDistance
self.lastOcclusionReachedTime = currentTime
self.isZoomingOut = false
else -- make it hard/slow for camera to zoom out
self.isZoomingOut = true
if occlusionDistance > self.lastOcclusionDistance - 2 and occlusionDistance ~= 0 then -- reset timer if occlusion significantly increased since last frame
self.lastOcclusionReachedTime = currentTime
end
-- If occlusion pops camera in to almost first person for a short time, pop out instantly
if currentTime < self.timeLastPoppedWayIn + self.defaultTimeUntilZoomOut and self.lastOcclusionDistance / self.normalOffset.Z > 0.8 then
self.lastOcclusionDistance = occlusionDistance
self.lastOcclusionReachedTime = currentTime
self.isZoomingOut = false
elseif currentTime >= self.timeLastPoppedWayIn + self.defaultTimeUntilZoomOut and self.timeLastPoppedWayIn ~= 0 then
self.timeLastPoppedWayIn = 0
end
end
-- Update occlusion amount if timeout time has passed
if currentTime >= self.lastOcclusionReachedTime + self.timeUntilZoomOut and not self.zoomState then
if self.curOcclusionTween == nil then
self.occlusionTweenObject.Value = self.lastOcclusionDistance
local tweenInfo = TweenInfo.new(self.tweenOutTime)
local goal = {}
goal.Value = self.lastOcclusionDistance - self.normalOffset.Z
self.curOcclusionTween = TweenService:Create(self.occlusionTweenObject, tweenInfo, goal)
self.curOcclusionTween:Play()
end
end
-- Apply occlusion to camera CFrame
local currentOffsetDir = self.currentCFrame.LookVector.Unit
self.currentCFrame = self.currentCFrame + (currentOffsetDir * self.lastOcclusionDistance)
self.currentCamera.CFrame = self.currentCFrame
-- Apply recoil decay
self.currentRecoil = self.currentRecoil - (self.currentRecoil * self.recoilDecay * dt)
if self:isHumanoidControllable() and self.rotateCharacterWithCamera then
self.currentHumanoid.AutoRotate = false
self.currentRootPart.CFrame = CFrame.Angles(0, self.yaw, 0) + self.currentRootPart.Position -- rotate character to be upright and facing the same direction as camera
self:applyRootJointFix()
else
self.currentHumanoid.AutoRotate = true
end
self:handlePartTransparencies()
self:handleTouchToolFiring()
end
|
--!strict
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger
|
return function(value)
return type(value) == "number" and value ~= math.huge and value == math.floor(value)
end
|
--[[
Returns a new list with the new value replaced at the given index.
]]
|
local function replaceIndex(list, index, value)
local new = {}
local len = #list
assert(index <= len, "index must be less or equal than the list length")
for i = 1, len do
if i == index then
new[i] = value
else
new[i] = list[i]
end
end
return new
end
return replaceIndex
|
--------AUDIENCE BACK RIGHT--------
|
game.Workspace.audiencebackright1.Part1.BrickColor = BrickColor.new(1013)
game.Workspace.audiencebackright1.Part2.BrickColor = BrickColor.new(1013)
game.Workspace.audiencebackright1.Part3.BrickColor = BrickColor.new(1013)
game.Workspace.audiencebackright1.Part4.BrickColor = BrickColor.new(1023)
game.Workspace.audiencebackright1.Part5.BrickColor = BrickColor.new(1023)
game.Workspace.audiencebackright1.Part6.BrickColor = BrickColor.new(1023)
game.Workspace.audiencebackright1.Part7.BrickColor = BrickColor.new(106)
game.Workspace.audiencebackright1.Part8.BrickColor = BrickColor.new(106)
game.Workspace.audiencebackright1.Part9.BrickColor = BrickColor.new(106)
|
--WARNING!
--DO NOT MODIFY THE CODE BELOW! (Unless you know what you're doing, in that case: Go nuts!)
|
local motor = script.Parent.Main.Base.HingeConstraint
local display = script.Parent.Display.SurfaceGui.TextLabel
local current_mode = 0
function Mode_Up()
if current_mode < max_mode then
current_mode = current_mode + 1
motor.AngularVelocity = motor.AngularVelocity + increment_speed
display.Text = current_mode
end
end
function Mode_Down()
if current_mode > min_mode then
current_mode = current_mode - 1
motor.AngularVelocity = motor.AngularVelocity - increment_speed
display.Text = current_mode
end
end
script.Parent.Button_Up.ClickDetector.mouseClick:connect(Mode_Up)
script.Parent.Button_Down.ClickDetector.mouseClick:connect(Mode_Down)
|
--[[
Returns the existing instance of the specified `instanceType` with name
`instanceName` that is a child of 'parent', otherwise that instance to
return.
This function is called when creating or obtaining the instance for the
AvatarScreenGui or AssetsFolder used for MerchBooth.
]]
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
-- Fetch the ID list
|
local IDList = require(script:FindFirstChildWhichIsA("ModuleScript"))
|
--For Omega Rainbow Katana thumbnail to display a lot of particles.
|
for i, v in pairs(Handle:GetChildren()) do
if v:IsA("ParticleEmitter") then
v.Rate = 20
end
end
Tool.Grip = Grips.Up
Tool.Enabled = true
function IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function Blow(Hit)
if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then
return
end
local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
if not RightArm then
return
end
local RightGrip = RightArm:FindFirstChild("RightGrip")
if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
return
end
local character = Hit.Parent
if character == Character then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid or humanoid.Health == 0 then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and (player == Player or IsTeamMate(Player, player)) then
return
end
UntagHumanoid(humanoid)
TagHumanoid(humanoid, Player)
humanoid:TakeDamage(Damage)
task.wait(0.25)
Tool:Destroy()
end
function Attack()
Damage = DamageValues.SlashDamage
Sounds.Slash:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Slash"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Slash")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
end
function Lunge()
Damage = DamageValues.LungeDamage
Sounds.Lunge:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Lunge"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Lunge")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
--[[
if CheckIfAlive() then
local Force = Instance.new("BodyVelocity")
Force.velocity = Vector3.new(0, 10, 0)
Force.maxForce = Vector3.new(0, 4000, 0)
Debris:AddItem(Force, 0.4)
Force.Parent = Torso
end
]]
task.wait(0.2)
Tool.Grip = Grips.Out
task.wait(0.6)
Tool.Grip = Grips.Up
Damage = DamageValues.SlashDamage
end
Tool.Enabled = true
LastAttack = 0
function Activated()
if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
return
end
Tool.Enabled = false
local Tick = task.wait()
if (Tick - LastAttack < 0.2) then
Lunge()
else
Attack()
end
LastAttack = Tick
--wait(0.5)
Damage = DamageValues.BaseDamage
local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){
Name = "R15Slash",
AnimationId = BaseUrl .. Animations.R15Slash,
Parent = Tool
})
local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){
Name = "R15Lunge",
AnimationId = BaseUrl .. Animations.R15Lunge,
Parent = Tool
})
Tool.Enabled = true
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChildOfClass("Humanoid")
Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart")
if not CheckIfAlive() then
return
end
ToolEquipped = true
Sounds.Unsheath:Play()
end
function Unequipped()
Tool.Grip = Grips.Up
ToolEquipped = false
end
Tool.Activated:Connect(Activated)
Tool.Equipped:Connect(Equipped)
Tool.Unequipped:Connect(Unequipped)
Connection = Handle.Touched:Connect(Blow)
|
--yes i did put that thing there to hide how simple this is :)
--ignore
|
local CPSI = 0
local Values = script.Parent.Parent:FindFirstChild("A-Chassis Interface")
local Throttle = Values.Values.Throttle.Value
local CurrentGear = Values.Values.Gear.Value
local CurrentRPM = Values.Values.RPM.Value
local _Tune = require(car["A-Chassis Tune"])
local MaxRPM = _Tune.Redline
Values.Values.TPSI.Value = PSI
local DEADBOOST = PSI - 0.5
local active = false
local boom = true
|
-----------------
--| Functions |--
-----------------
|
local function MakeBaseRocket()
-- Set up the rocket part
local rocket = Instance.new('Part')
rocket.Name = 'Rocket'
rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
rocket.Size = ROCKET_PART_SIZE
rocket.CanCollide = false
rocket.BottomSurface = Enum.SurfaceType.Smooth
rocket.TopSurface = Enum.SurfaceType.Smooth
-- Add the mesh
local mesh = Instance.new('SpecialMesh', rocket)
mesh.MeshId = ROCKET_MESH_ID
mesh.Scale = ROCKET_MESH_SCALE
mesh.TextureId = ToolHandle.Mesh.TextureId
-- Add fire
local fire = Instance.new('Fire', rocket)
fire.Heat = 5
fire.Size = 2
-- Add the propulsion
local rocketPropulsion = Instance.new('RocketPropulsion', rocket)
rocketPropulsion.CartoonFactor = 1
rocketPropulsion.TargetRadius = TARGET_RADIUS
rocketPropulsion.MaxSpeed = MAX_SPEED
rocketPropulsion.MaxTorque = MAX_TORQUE
rocketPropulsion.MaxThrust = MAX_THRUST
rocketPropulsion.ThrustP = THRUST_P
rocketPropulsion.ThrustD = THRUST_D
-- Clone the sounds
local swooshSoundClone = SwooshSound:Clone()
swooshSoundClone.Parent = rocket
local boomSoundClone = BoomSound:Clone()
boomSoundClone.Parent = rocket
-- Attach creator tags
local creatorTag = Instance.new('ObjectValue', rocket)
creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
creatorTag.Value = MyPlayer
local iconTag = Instance.new('StringValue', creatorTag)
iconTag.Name = 'icon'
iconTag.Value = Tool.TextureId
-- Finally, clone the rocket script and enable it
local rocketScriptClone = RocketScript:Clone()
rocketScriptClone.Parent = rocket
rocketScriptClone.Disabled = false
return rocket
end
local function OnEquipped()
MyModel = Tool.Parent
MyPlayer = PlayersService:GetPlayerFromCharacter(MyModel)
BaseRocket = MakeBaseRocket()
RocketClone = BaseRocket:Clone()
end
local function OnActivated(byFireButton)
if Tool.Enabled and MyModel and MyModel:FindFirstChild('Humanoid') and MyModel.Humanoid.Health > 0 then
Tool.Enabled = false
-- Get the target position
local targetPosition = MyModel.Humanoid.TargetPoint
if byFireButton then -- Using Fire Button, shoot forwards
targetPosition = MyModel.Humanoid.Torso.CFrame.lookVector * 1000
end
-- Position the rocket clone
local spawnPosition = ToolHandle.Position + (ToolHandle.CFrame.lookVector * (ToolHandle.Size.z / 2))
RocketClone.CFrame = CFrame.new(spawnPosition, targetPosition) --NOTE: This must be done before assigning Parent
DebrisService:AddItem(RocketClone, 30)
RocketClone.Parent = Workspace
-- Assign target and launch!
local rocketPropulsion = RocketClone:FindFirstChild('RocketPropulsion')
if rocketPropulsion then
local direction = (targetPosition - RocketClone.Position).unit
rocketPropulsion.TargetOffset = RocketClone.Position + (direction * TARGET_OVERSHOOT_DISTANCE)
rocketPropulsion:Fire()
end
wait(0) --TODO: Remove when sounds realize they can be played as soon as they enter the Workspace
-- Swoosh!
local swooshSound = RocketClone:FindFirstChild('Swoosh')
if swooshSound then
swooshSound:Play()
end
-- Prepare the next rocket to be fired
RocketClone = BaseRocket:Clone()
ReloadSound:Play()
wait(COOLDOWN)
-- Stop the reloading sound if it hasn't already finished
ReloadSound:Stop()
Tool.Enabled = true
end
end
local function OnUnequipped()
ReloadSound:Stop() --TODO: This does not work online
end
|
-------------------------
|
function DoorClose()
if Shaft00.MetalDoor.CanCollide == false then
Shaft00.MetalDoor.CanCollide = true
while Shaft00.MetalDoor.Transparency > 0.0 do
Shaft00.MetalDoor.Transparency = Shaft00.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) --Change 10 to change the speed.
end
if Shaft01.MetalDoor.CanCollide == false then
Shaft01.MetalDoor.CanCollide = true
while Shaft01.MetalDoor.Transparency > 0.0 do
Shaft01.MetalDoor.Transparency = Shaft01.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft02.MetalDoor.CanCollide == false then
Shaft02.MetalDoor.CanCollide = true
while Shaft02.MetalDoor.Transparency > 0.0 do
Shaft02.MetalDoor.Transparency = Shaft02.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft03.MetalDoor.CanCollide == false then
Shaft03.MetalDoor.CanCollide = true
while Shaft03.MetalDoor.Transparency > 0.0 do
Shaft03.MetalDoor.Transparency = Shaft03.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft04.MetalDoor.CanCollide == false then
Shaft04.MetalDoor.CanCollide = true
while Shaft04.MetalDoor.Transparency > 0.0 do
Shaft04.MetalDoor.Transparency = Shaft04.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft05.MetalDoor.CanCollide == false then
Shaft05.MetalDoor.CanCollide = true
while Shaft05.MetalDoor.Transparency > 0.0 do
Shaft05.MetalDoor.Transparency = Shaft05.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft06.MetalDoor.CanCollide == false then
Shaft06.MetalDoor.CanCollide = true
while Shaft06.MetalDoor.Transparency > 0.0 do
Shaft06.MetalDoor.Transparency = Shaft06.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft07.MetalDoor.CanCollide == false then
Shaft07.MetalDoor.CanCollide = true
while Shaft07.MetalDoor.Transparency > 0.0 do
Shaft07.MetalDoor.Transparency = Shaft07.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft08.MetalDoor.CanCollide == false then
Shaft08.MetalDoor.CanCollide = true
while Shaft08.MetalDoor.Transparency > 0.0 do
Shaft08.MetalDoor.Transparency = Shaft08.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft09.MetalDoor.CanCollide == false then
Shaft09.MetalDoor.CanCollide = true
while Shaft09.MetalDoor.Transparency > 0.0 do
Shaft09.MetalDoor.Transparency = Shaft09.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft10.MetalDoor.CanCollide == false then
Shaft10.MetalDoor.CanCollide = true
while Shaft10.MetalDoor.Transparency > 0.0 do
Shaft10.MetalDoor.Transparency = Shaft10.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft11.MetalDoor.CanCollide == false then
Shaft11.MetalDoor.CanCollide = true
while Shaft11.MetalDoor.Transparency > 0.0 do
Shaft11.MetalDoor.Transparency = Shaft11.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft12.MetalDoor.CanCollide == false then
Shaft12.MetalDoor.CanCollide = true
while Shaft12.MetalDoor.Transparency > 0.0 do
Shaft12.MetalDoor.Transparency = Shaft12.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft13.MetalDoor.CanCollide == false then
Shaft13.MetalDoor.CanCollide = true
while Shaft13.MetalDoor.Transparency > 0.0 do
Shaft13.MetalDoor.Transparency = Shaft13.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
end
function onClicked()
DoorClose()
end
script.Parent.MouseButton1Click:connect(onClicked)
script.Parent.MouseButton1Click:connect(function()
if clicker == true
then clicker = false
else
return
end
end)
script.Parent.MouseButton1Click:connect(function()
Car.Touched:connect(function(otherPart)
if otherPart == Elevator.Floors.F04
then StopE() DoorOpen()
end
end)end)
function StopE()
Car.BodyVelocity.velocity = Vector3.new(0, 0, 0)
Car.BodyPosition.position = Elevator.Floors.F04.Position
clicker = true
end
function DoorOpen()
while Shaft03.MetalDoor.Transparency < 1.0 do
Shaft03.MetalDoor.Transparency = Shaft03.MetalDoor.Transparency + .1
wait(0.000001)
end
Shaft03.MetalDoor.CanCollide = false
end
|
--WeldRec(P.Parent.Lights)
|
for _,v in pairs(weldedParts) do
if v:IsA("BasePart") then
v.Anchored = false
end
end
script.Parent.Keyscreen.Fob.Value = script.Parent
script:Destroy()
|
-- @Description Clamp a certain vector's magnitude to a Max
-- @Arg1 Vector
-- @Arg2 Max
|
function Basic.ClampMagnitude(v, max)
return v.Unit * math.min(v.Magnitude, max)
end
|
-- Nominal distance, set by dollying in and out with the mouse wheel or equivalent, not measured distance
|
function BaseCamera:GetCameraToSubjectDistance(): number
return self.currentSubjectDistance
end
|
--[[
Chooses between the different GuiTypes that the emotes can be displayed in
]]
|
local Roact = require(script.Parent.Parent.Packages.Roact)
local t = require(script.Parent.Parent.Packages.t)
local configs = require(script.Parent.Parent.config)
local ConfigurationContext = require(script.Parent.Parent.DevModuleConfig.ConfigurationContext)
local enums = require(script.Parent.Parent.enums)
local EmoteBar = require(script.Parent.EmoteBar)
local EmoteWheelBillboard = require(script.Parent.EmoteWheelBillboard)
local EmoteView = Roact.Component:extend("EmoteView")
EmoteView.defaultProps = {
isVisible = true,
forceHide = false,
}
EmoteView.validateProps = t.strictInterface({
forceHide = t.boolean,
isVisible = t.boolean,
configuration = configs.client.validate,
})
function EmoteView:render()
local guiType = self.props.configuration.guiType
if guiType == enums.GuiType.EmoteBar then
return Roact.createElement(EmoteBar, {
isVisible = self.props.isVisible and not self.props.forceHide,
})
elseif guiType == enums.GuiType.EmoteWheel then
return Roact.createElement(EmoteWheelBillboard, {
isVisible = self.props.isVisible,
})
end
end
return ConfigurationContext.withConfiguration(EmoteView)
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
function Datastore.Get(datastore, key, scope)
--- Sanity check
if key == nil or datastore == nil then
_L.Print("Key or datastore nil", true)
return
end
--- If datastore argument is not a datastore obj - find it, and cache it to save memory
if type(datastore) == "string" then
if not datastoresCache[datastore] then
datastoresCache[datastore] = {}
end
if not datastoresCache[datastore][scope] then
datastoresCache[datastore][scope] = _L.Services.DataStoreService:GetDataStore(datastore, scope)
end
datastore = datastoresCache[datastore][scope]
end
--- Attempt it
local attempts = 0
local success = false
local returnedValue
--
while (attempts < maxGetAttempts and returnedValue == nil) do
attempts = attempts + 1
success = pcall(function()
returnedValue = datastore:GetAsync(key)
end)
if not success then
wait(.5)
end
end
--- Debug prints
if Debug then
if attempts >= maxGetAttempts or returnedValue == nil then
_L.Print("Could not get key --- [bold]" .. key .. "[/bold]", true)
end
end
--
return returnedValue, success
end
function Datastore.Set(datastore, key, value, scope)
--- Sanity check
if key == nil or value == nil or datastore == nil then
_L.Print("Key, value, or datastore nil", true)
return false
end
--- If datastore argument is not a datastore obj - find it, and cache it to save memory
if type(datastore) == "string" then
if not datastoresCache[datastore] then
datastoresCache[datastore] = {}
end
if not datastoresCache[datastore][scope] then
datastoresCache[datastore][scope] = _L.Services.DataStoreService:GetDataStore(datastore, scope)
end
datastore = datastoresCache[datastore][scope]
end
--- Attempt it
local attempts = 0
local success = false
--
repeat
attempts = attempts + 1
success = pcall(function()
datastore:SetAsync(key, value)
end)
if not success then
wait(.5)
end
until success or attempts >= maxSetAttempts
--- Debug prints
if Debug then
if attempts >= maxSetAttempts then
_L.Print("Failed to set key --- [bold]" .. key .. "[/bold]", true)
end
end
--
return success
end
function Datastore.Update(datastore, key, updateFunction, scope)
--- Sanity check
if key == nil or updateFunction == nil or datastore == nil then
_L.Print("Key, function, or datastore nil", true)
return false
end
--- If datastore argument is not a datastore obj - find it, and cache it to save memory
if type(datastore) == "string" then
if not datastoresCache[datastore] then
datastoresCache[datastore] = {}
end
if not datastoresCache[datastore][scope] then
datastoresCache[datastore][scope] = _L.Services.DataStoreService:GetDataStore(datastore, scope)
end
datastore = datastoresCache[datastore][scope]
end
--- Attempt it
local attempts = 0
local success = false
--
repeat
attempts = attempts + 1
success = pcall(function()
datastore:UpdateAsync(key, updateFunction)
end)
if not success then
wait(.5)
end
until success or attempts >= maxUpdateAttempts
--- Debug prints
if Debug then
if attempts >= maxUpdateAttempts then
_L.Print("Failed to update key --- [bold]" .. key .. "[/bold]", true)
end
end
--
return success
end
|
--Weld stuff here
|
unit.MainSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0)
end
end)
|
--------------------------------------------------------------------------------
|
local function queryPoint(origin, unitDir, dist, lastPos)
debug.profilebegin("queryPoint")
local originalSize = #blacklist
dist = dist + nearPlaneZ
local target = origin + unitDir*dist
local softLimit = inf
local hardLimit = inf
local movingOrigin = origin
local numPierced = 0
repeat
local entryPart, entryPos = workspace:FindPartOnRayWithIgnoreList(ray(movingOrigin, target - movingOrigin), blacklist, false, true)
numPierced += 1
if entryPart then
-- forces the current iteration into a hard limit to cap the number of raycasts
local earlyAbort = numPierced >= QUERY_POINT_CAST_LIMIT
if canOcclude(entryPart) or earlyAbort then
local wl = {entryPart}
local exitPart = workspace:FindPartOnRayWithWhitelist(ray(target, entryPos - target), wl, true)
local lim = (entryPos - origin).Magnitude
if exitPart and not earlyAbort then
local promote = false
if lastPos then
promote =
workspace:FindPartOnRayWithWhitelist(ray(lastPos, target - lastPos), wl, true) or
workspace:FindPartOnRayWithWhitelist(ray(target, lastPos - target), wl, true)
end
if promote then
-- Ostensibly a soft limit, but the camera has passed through it in the last frame, so promote to a hard limit.
hardLimit = lim
elseif dist < softLimit then
-- Trivial soft limit
softLimit = lim
end
else
-- Trivial hard limit
hardLimit = lim
end
end
blacklist[#blacklist + 1] = entryPart
movingOrigin = entryPos - unitDir*1e-3
end
until hardLimit < inf or not entryPart
eraseFromEnd(blacklist, originalSize)
debug.profileend()
return softLimit - nearPlaneZ, hardLimit - nearPlaneZ
end
local function queryViewport(focus, dist)
debug.profilebegin("queryViewport")
local fP = focus.p
local fX = focus.rightVector
local fY = focus.upVector
local fZ = -focus.lookVector
local viewport = camera.ViewportSize
local hardBoxLimit = inf
local softBoxLimit = inf
-- Center the viewport on the PoI, sweep points on the edge towards the target, and take the minimum limits
for viewX = 0, 1 do
local worldX = fX*((viewX - 0.5)*projX)
for viewY = 0, 1 do
local worldY = fY*((viewY - 0.5)*projY)
local origin = fP + nearPlaneZ*(worldX + worldY)
local lastPos = camera:ViewportPointToRay(
viewport.x*viewX,
viewport.y*viewY
).Origin
local softPointLimit, hardPointLimit = queryPoint(origin, fZ, dist, lastPos)
if hardPointLimit < hardBoxLimit then
hardBoxLimit = hardPointLimit
end
if softPointLimit < softBoxLimit then
softBoxLimit = softPointLimit
end
end
end
debug.profileend()
return softBoxLimit, hardBoxLimit
end
local function testPromotion(focus, dist, focusExtrapolation)
debug.profilebegin("testPromotion")
local fP = focus.p
local fX = focus.rightVector
local fY = focus.upVector
local fZ = -focus.lookVector
do
-- Dead reckoning the camera rotation and focus
debug.profilebegin("extrapolate")
local SAMPLE_DT = 0.0625
local SAMPLE_MAX_T = 1.25
local maxDist = (getCollisionPoint(fP, focusExtrapolation.posVelocity*SAMPLE_MAX_T) - fP).Magnitude
-- Metric that decides how many samples to take
local combinedSpeed = focusExtrapolation.posVelocity.magnitude
for dt = 0, min(SAMPLE_MAX_T, focusExtrapolation.rotVelocity.magnitude + maxDist/combinedSpeed), SAMPLE_DT do
local cfDt = focusExtrapolation.extrapolate(dt) -- Extrapolated CFrame at time dt
if queryPoint(cfDt.p, -cfDt.lookVector, dist) >= dist then
return false
end
end
debug.profileend()
end
do
-- Test screen-space offsets from the focus for the presence of soft limits
debug.profilebegin("testOffsets")
for _, offset in ipairs(SCAN_SAMPLE_OFFSETS) do
local scaledOffset = offset
local pos = getCollisionPoint(fP, fX*scaledOffset.x + fY*scaledOffset.y)
if queryPoint(pos, (fP + fZ*dist - pos).Unit, dist) == inf then
return false
end
end
debug.profileend()
end
debug.profileend()
return true
end
local function Popper(focus, targetDist, focusExtrapolation)
debug.profilebegin("popper")
subjectRoot = subjectPart and subjectPart:GetRootPart() or subjectPart
local dist = targetDist
local soft, hard = queryViewport(focus, targetDist)
if hard < dist then
dist = hard
end
if soft < dist and testPromotion(focus, targetDist, focusExtrapolation) then
dist = soft
end
subjectRoot = nil
debug.profileend()
return dist
end
return Popper
|
--[[Rear]]
|
--
Tune.RTireProfile = 1 -- Tire profile, aggressive or smooth
Tune.RProfileHeight = .45 -- Profile height, conforming to tire
Tune.RTireCompound = 2 -- The more compounds you have, the harder your tire will get towards the middle, sacrificing grip for wear
Tune.RTireFriction = 1.8 -- Your tire's friction in the best conditions.
|
-- Get all possible gamepasses
|
for i,v in pairs(Tycoon:WaitForChild('Buttons'):GetChildren()) do
if v:FindFirstChild('Gamepass') then
if v.Gamepass.Value > 0 then
GamePasses[v.Gamepass.Value] = v -- the button
end
end
end
MarketplaceService.ProcessReceipt = function(receiptInfo)
for i,plr in pairs(game.Players:GetPlayers()) do
if plr.userId == receiptInfo.PlayerId then
if DevProducts[receiptInfo.ProductId] then
for p,b in pairs(script.Parent.Tycoons[plr.team.name]:WaitForChild('Buttons'):GetChildren()) do
if b:FindFirstChild('DevProduct') then
if b.DevProduct.Value == receiptInfo.ProductId then
local PlrT = game.ServerStorage.PlayerMoney:WaitForChild(plr.Name).OwnsTycoon
if PlrT.Value ~= nil then
local PlayerStats = game.ServerStorage.PlayerMoney:FindFirstChild(plr.Name)
Create({[1] = 0,[2] = b,[3] = PlayerStats}, PlrT.Value.BuyObject)
end
break
end
end
end
end
end
end
end
local function gamepassPurchaseFinished(player,gamepass,bought)
if bought then
for i,plr in pairs(game.Players:GetPlayers()) do
if plr.userId == player.userId then
if GamePasses[gamepass] then
for p,b in pairs(script.Parent.Tycoons[plr.team.name]:WaitForChild('Buttons'):GetChildren()) do
if b:FindFirstChild('Gamepass') then
if b.Gamepass.Value == gamepass then
local PlrT = game.ServerStorage.PlayerMoney:WaitForChild(plr.Name).OwnsTycoon
if PlrT.Value ~= nil then
local PlayerStats = game.ServerStorage.PlayerMoney:FindFirstChild(plr.Name)
Create({[1] = 0,[2] = b, [3] = PlayerStats}, PlrT.Value.BuyObject)
end
break
end
end
end
end
end
end
end
end
MarketplaceService.PromptGamePassPurchaseFinished:Connect(gamepassPurchaseFinished)
function Create(tab, prnt)
local x = Instance.new('Model')
Instance.new('NumberValue',x).Value = tab[1]
x.Value.Name = "Cost"
Instance.new('ObjectValue',x).Value = tab[2]
x.Value.Name = "Button"
local Obj = Instance.new('ObjectValue',x)
Obj.Name = "Stats"
Obj.Value = tab[3]
x.Parent = prnt
end
|
--[=[
The same as [Promise.new](/api/Promise#new), except execution begins after the next `Heartbeat` event.
This is a spiritual replacement for `spawn`, but it does not suffer from the same [issues](https://eryn.io/gist/3db84579866c099cdd5bb2ff37947cec) as `spawn`.
```lua
local function waitForChild(instance, childName, timeout)
return Promise.defer(function(resolve, reject)
local child = instance:WaitForChild(childName, timeout)
;(child and resolve or reject)(child)
end)
end
```
@param executor (resolve: (...: any) -> (), reject: (...: any) -> (), onCancel: (abortHandler?: () -> ()) -> boolean) -> ()
@return Promise
]=]
|
function Promise.defer(executor)
local traceback = debug.traceback(nil, 2)
local promise
promise = Promise._new(traceback, function(resolve, reject, onCancel)
local connection
connection = Promise._timeEvent:Connect(function()
connection:Disconnect()
local ok, _, result = runExecutor(traceback, executor, resolve, reject, onCancel)
if not ok then
reject(result[1])
end
end)
end)
return promise
end
|
--!nonstrict
--[[ Constants ]]
|
--
local ZERO_VECTOR3 = Vector3.new(0,0,0)
local TOUCH_CONTROLS_SHEET = "rbxasset://textures/ui/Input/TouchControlsSheetV2.png"
local DYNAMIC_THUMBSTICK_ACTION_NAME = "DynamicThumbstickAction"
local DYNAMIC_THUMBSTICK_ACTION_PRIORITY = Enum.ContextActionPriority.High.Value
local MIDDLE_TRANSPARENCIES = {
1 - 0.89,
1 - 0.70,
1 - 0.60,
1 - 0.50,
1 - 0.40,
1 - 0.30,
1 - 0.25
}
local NUM_MIDDLE_IMAGES = #MIDDLE_TRANSPARENCIES
local FADE_IN_OUT_BACKGROUND = true
local FADE_IN_OUT_MAX_ALPHA = 0.35
local FADE_IN_OUT_HALF_DURATION_DEFAULT = 0.3
local FADE_IN_OUT_BALANCE_DEFAULT = 0.5
local ThumbstickFadeTweenInfo = TweenInfo.new(0.15, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local Players = game:GetService("Players")
local GuiService = game:GetService("GuiService")
local UserInputService = game:GetService("UserInputService")
local ContextActionService = game:GetService("ContextActionService")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local LocalPlayer = Players.LocalPlayer
if not LocalPlayer then
Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
LocalPlayer = Players.LocalPlayer
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
return {
Name = "blink",
Aliases = { "b" },
Description = "Teleports you to where your mouse is hovering.",
Group = "DefaultDebug",
Args = {},
ClientRun = function(p1)
local l__Character__1 = p1.Executor.Character;
if not l__Character__1 then
return "You don't have a character.";
end;
l__Character__1:MoveTo(p1.Executor:GetMouse().Hit.p);
return "Blinked!";
end
};
|
-- Load Roblox Camera Controller Modules
|
local ClassicCamera = require(script:WaitForChild("ClassicCamera"))
local OrbitalCamera = require(script:WaitForChild("OrbitalCamera"))
local LegacyCamera = require(script:WaitForChild("LegacyCamera"))
|
-- functions
|
return function(character, boost)
local upperTorso = character.UpperTorso
local icon = script[boost].IconEmitter:Clone()
icon.Parent = upperTorso
local spark = script[boost].SparkEmitter:Clone()
spark.Parent = upperTorso
--[[local sound = script[boost .. "Sound"]:Clone()
sound.Parent = upperTorso]]
icon:Emit(10)
spark:Emit(25)
--sound:Play()
Debris:AddItem(icon, 2)
Debris:AddItem(spark, 2)
--Debris:AddItem(sound, sound.TimeLength)
end
|
-- xSIXx, Create an animatable joint when tool is equipped.
|
local motorName = "Handle" -- Change this to the target Motor6D name you want in the Right Arm/RightHand.
|
-- This finds the Aircraft that we are controlling
|
Parts = game.Players.LocalPlayer:FindFirstChild("Turret").Value;
VehicleStats = Parts.Stats;
local Settings = require(Parts.Parent.VehicleSettings)
function move(point, engine)
local origincframe = engine:findFirstChild("BodyGyro").cframe
local size = engine.Parent.Parent:GetExtentsSize()
local target = engine.Position+((point - engine.Position).unit*100)
local dir = (target - engine.Position).unit
local spawnPos = engine.Position
local left = engine.CFrame*CFrame.new(-size.x/2, 0, 0).p
local right = engine.CFrame*CFrame.new(size.x/2, 0, 0).p
local md = (target - engine.Position).magnitude
local foebmd = engine.CFrame*CFrame.new(0, 0, -md).p
local toleft = (target -left).magnitude
local toright = (target -right).magnitude
local rot = ((foebmd - target).magnitude/10)
local pos = spawnPos + (dir * 1)
local turn = math.rad((rot/10)*Settings.TiltFactor)
if turn > math.rad(89) then
turn = math.rad(89)
end
if toleft< toright and toleft >rot then
engine:findFirstChild("BodyGyro").cframe = CFrame.new(pos, (pos + dir))*CFrame.fromEulerAnglesXYZ(0, 0, turn)
elseif toleft > toright and toright >rot then
engine:findFirstChild("BodyGyro").cframe = CFrame.new(pos, (pos + dir))*CFrame.fromEulerAnglesXYZ(0, 0, -turn)
else
engine:findFirstChild("BodyGyro").cframe = CFrame.new(pos, -(pos + dir))
end
engine:findFirstChild("BodyGyro").P = Settings.TurnSpeed
end
function onMouseMove(mouse)
|
-- <Region> CreateRegion(<Vector3> Center, <Vector3> Rotation, <Vector3> Size)
|
--Creates Region with specific input
--Returns <Region>
local function CreateRegion(Center, Rotation, Size)
local Region = {}
Region.Center = Center or Vector3.new(0, 0, 0)
Region.Rotation = Rotation or Vector3.new(0, 0, 0)
Region.Size = Size or Vector3.new(0, 0, 0)
function Region:isInRegion(Part)
return isInRegion(Region, Part)
end
function Region:isInRegionIgnoreY(Part)
return isInRegionIgnoreY(Region, Part)
end
return Region
end
|
--!nonstrict
--[[
VRCamera - Roblox VR camera control module
2021 Roblox VR
--]]
| |
--now, load the zone & music data into the script
|
local zones = {}
local music = {}
local globali
if settings.UseMusicZones == true then
for i,zone in pairs(zonesfolder:GetChildren()) do
if zone:IsA("Model") and zone:FindFirstChild("Music") then
music[i] = {}
for _,sound in pairs(zone.Music:GetChildren()) do --save all of the music data for this zone
if sound:IsA("Sound") then
table.insert(music[i], {["SoundId"] = sound.SoundId, ["Volume"] = sound.Volume, ["Pitch"] = sound.Pitch})
end
end
zones[i] = {
["Priority"] = zone:FindFirstChild("Priority") and zone.Priority.Value or 1,
["Parts"] = {},
["Music"] = music[i]
}
for _,part in pairs(zone:GetChildren()) do
if part:IsA("Part") then
if IsCleanRotation({part.Rotation.X,part.Rotation.Y,part.Rotation.Z}) == true then --store the min and max X/Y/Z position coordinates of this part
local lx,ly,lz = math.huge,math.huge,math.huge
local mx,my,mz = -math.huge,-math.huge,-math.huge
local function ApplyValues(p)
if p.x < lx then lx = p.x end
if p.x > mx then mx = p.x end
if p.y < ly then ly = p.y end
if p.y > my then my = p.y end
if p.z < lz then lz = p.z end
if p.z > mz then mz = p.z end
end
local points = {}
--a bunch of sloppy math stuff to calculate the coordinates on each of the part's faces so we can figure out the min and max values. mathematicians, pls don't kill me if i'm doing this terribly
local cf1 = part.CFrame
local cf2 = (part.CFrame * CFrame.Angles(0,math.pi/2,0))
local cf3 = (part.CFrame * CFrame.Angles(math.pi/2,0,0))
local lvz = (cf1.lookVector * (part.Size.Z/2))
local lvx = (cf2.lookVector * (part.Size.X/2))
local lvy = (cf3.lookVector * (part.Size.Y/2))
points[1] = cf1+lvz
points[2] = cf1-lvz
points[3] = cf2+lvx
points[4] = cf2-lvx
points[5] = cf3+lvy
points[6] = cf3-lvy
for _,p in pairs(points) do
ApplyValues(p)
end
table.insert(zones[i]["Parts"],{["Coordinates"] = {lx=lx,ly=ly,lz=lz, mx=mx,my=my,mz=mz}})
else --save a reference to the part itself to be used for GetTouchingParts(), since it has a complex rotation that can't be solved with my own feeble calculations
table.insert(zones[i]["Parts"],{["Part"] = part})
end
end
end
end
end
end
if settings.UseGlobalBackgroundMusic == true then
globali = #music + 1
music[globali] = {}
for _,sound in pairs(globalfolder:GetChildren()) do
if sound:IsA("Sound") then
table.insert(music[globali], {["SoundId"] = sound.SoundId, ["Volume"] = sound.Volume, ["Pitch"] = sound.Pitch})
end
end
end
|
--[=[
Utility methods involving maids and tasks.
@class MaidTaskUtils
]=]
| |
-- @Description Basic linear interpolation
-- @Arg1 Time
-- @Arg2 StartingValue
-- @Arg3 EndingValue
|
function Interpolate.Linear(p0, p1, t)
t = math.clamp(t, 0, 1)
return (1-t)*p0 + t*p1
end
function Interpolate.QuadInOut(t)
return t < 0.5 and 2 * t * t or 1 - math.pow(-2 * t + 2, 2) / 2
end
function Interpolate.Bezier(p0, p1, p2, t)
return (1 - t)^2 * p0 + 2 * (1 - t) * t * p1 + t^2 * p2
end
return Interpolate
|
-- Require this module on the client. Add timers to operate and coordinate UI.
| |
--Char.Humanoid.BreakJointsOnDeath = false
|
if configuracao.EnableRagdoll == true then
Char.Humanoid.Died:Connect(function()
Ragdoll(Char)
end)
end
RS.Heartbeat:connect(function()
if Sangrando.Value == true then
if PastasStan.Tourniquet.Value == false then
Sang.Value = (Sang.Value - (MLs.Value/120))
UltimoSang = Sang.Value
MLs.Value = MLs.Value + 0.025
end
end
if PastasStan.Tourniquet.Value == true then
Dor.Value = Dor.Value + 0.1
end
if (human.Health - ultimavida < 0) then
Sang.Value = Sang.Value + (human.Health - ultimavida)*((configuracao.BloodMult)*(configuracao.BloodMult)*(configuracao.BloodMult))
UltimoSang = Sang.Value
end
if (human.Health - ultimavida < 0) then
Dor.Value = math.ceil(Dor.Value + (human.Health - ultimavida)*(-configuracao.PainMult))
--Energia.Value = math.ceil(Energia.Value + (human.Health - ultimavida)*(5))
end
if (human.Health - ultimavida < 0) --[[and (Sangrando.Value == true)]] then
MLs.Value = MLs.Value + ((ultimavida - human.Health)* (configuracao.BloodMult))
end
if script.Parent.Parent.Humanoid.Health < ultimavida -(configuracao.BleedDamage) then
Sangrando.Value = true
if script.Parent.Parent.Humanoid.Health < ultimavida -(configuracao.InjuredDamage) then
Ferido.Value = true
if script.Parent.Parent.Humanoid.Health < ultimavida -(configuracao.KODamage) then
Caido.Value = true
end
end
end
if human.Health >= human.MaxHealth and Sangrando.Value == false then
Sang.Value = Sang.Value + 0.5
Dor.Value = Dor.Value - 0.025
MLs.Value = MLs.Value - 0.025
end
if Sang.Value <= 0 then
human.Health = 0
end
ultimavida = script.Parent.Parent.Humanoid.Health
spawn(function(timer)
if Sang.Value >= 3500 and Dor.Value < 200 and Caido.Value == true and debounce == false then
debounce = true
wait(60)
Caido.Value = false
debounce = false
end
end)
end)
-- Quero um pouco de credito,plox :P --
-- FEITO 100% POR SCORPION --
-- Oficial Release 1.5 --
|
-- Dropdowns
|
local dropdownContainer = Instance.new("Frame")
dropdownContainer.Name = "DropdownContainer"
dropdownContainer.BackgroundTransparency = 1
dropdownContainer.BorderSizePixel = 0
dropdownContainer.AnchorPoint = Vector2.new(0.5, 0)
dropdownContainer.ZIndex = -2
dropdownContainer.ClipsDescendants = true
dropdownContainer.Visible = true
dropdownContainer.Parent = iconContainer
dropdownContainer.Selectable = false
dropdownContainer.Active = false
local dropdownFrame = Instance.new("ScrollingFrame")
dropdownFrame.Name = "DropdownFrame"
dropdownFrame.BackgroundTransparency = 1
dropdownFrame.BorderSizePixel = 0
dropdownFrame.AnchorPoint = Vector2.new(0.5, 0)
dropdownFrame.Position = UDim2.new(0.5, 0, 0, 0)
dropdownFrame.Size = UDim2.new(0.5, 2, 1, 0)
dropdownFrame.ZIndex = -1
dropdownFrame.ClipsDescendants = false
dropdownFrame.Visible = true
dropdownFrame.TopImage = dropdownFrame.MidImage
dropdownFrame.BottomImage = dropdownFrame.MidImage
dropdownFrame.VerticalScrollBarInset = Enum.ScrollBarInset.Always
dropdownFrame.VerticalScrollBarPosition = Enum.VerticalScrollBarPosition.Right
dropdownFrame.Parent = dropdownContainer
dropdownFrame.Active = false
dropdownFrame.Selectable = false
dropdownFrame.ScrollingEnabled = false
local dropdownList = Instance.new("UIListLayout")
dropdownList.Name = "DropdownList"
dropdownList.FillDirection = Enum.FillDirection.Vertical
dropdownList.SortOrder = Enum.SortOrder.LayoutOrder
dropdownList.Parent = dropdownFrame
local dropdownPadding = Instance.new("UIPadding")
dropdownPadding.Name = "DropdownPadding"
dropdownPadding.PaddingRight = UDim.new(0, 2)
dropdownPadding.Parent = dropdownFrame
|
--wait(0.1)
|
checker = Instance.new("Model")
checker.Name = "PGSCH"
checker.Parent = game.Workspace
checkertb = Instance.new("Part")
checkertb.Name = "Test"
checkertb.Parent = checker
checkertb.CanCollide = false
checkertb.TopSurface = Enum.SurfaceType.SmoothNoOutlines
checkertb.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
checkertb.Transparency = 0.8
StiffnessFront = StiffnessFront/0.5
StiffnessRear = StiffnessRear/0.5
AntiRollFront = AntiRollFront/0.5
AntiRollRear = AntiRollRear/0.5
checkertop = Instance.new("Part")
checkertop.Name = "Top"
checkertop.Parent = checker
checkertop.Anchored = true
checkertop.CanCollide = false
checkertop.TopSurface = Enum.SurfaceType.SmoothNoOutlines
checkertop.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
checkertop.Transparency = 0.8
checker1 = Instance.new("Attachment", checkertb)
checker2 = Instance.new("Attachment", checkertop)
checkerrope = Instance.new("RopeConstraint", checkertb)
checkerrope.Attachment0 = checker1
checkerrope.Attachment1 = checker2
checkerbf = Instance.new("BodyForce", checkertb)
checkerbf.Force = Vector3.new(0, -1000000, 0)
alertbbg = Instance.new("BillboardGui", script.Parent)
alertbbg.Size = UDim2.new(0, 500, 0, 100)
alertbbg.StudsOffset = Vector3.new(0,8,0)
alertbbg.AlwaysOnTop = true
alertbbg.Enabled = false
alerttext = Instance.new("TextLabel", alertbbg)
alerttext.BackgroundColor3 = Color3.new(97/255, 255/255, 176/255)
alerttext.BackgroundTransparency = 0.5
alerttext.TextSize = 24
alerttext.TextStrokeTransparency = 0.8
alerttext.Size = UDim2.new(1,0,1,0)
alerttext.BorderSizePixel = 0
alerttext.TextColor3 = Color3.new(1,1,1)
alerttext.TextWrapped = true
alerttext.Font = "SourceSans"
alerttext.Text = "PGSPhysicsSolver must be enabled to use this chassis! Enable this feature in the Workspace."
finesse = true
vr = 0
checker.ChildRemoved:connect(function(instance)
if finesse == true then
alertbbg.Enabled = true
vr = 1
end
end)
wait(0.8)
if vr == 0 then
finesse = false
checker:remove()
local PreS = script.Assets.PreSet:Clone()
PreS.Parent = script.Parent
PreS.Disabled = false
script.Parent:WaitForChild("PreSet")
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(math.rad(0.59), math.rad(0), math.rad(0))
if BRAKES_VISIBLE == true then
bv = 0
else
bv = 1
end
|
-- Settings and GameSettings are read only
|
local Settings = UserSettings() -- ignore warning
local GameSettings = Settings.GameSettings
local ShiftLockController = {}
|
-- Detect input ended
|
UIS.InputEnded:Connect(function(keycode)
-- Check if input lost was the U key.
if(keycode.KeyCode==Enum.KeyCode.E)then
-- make variable false
holdingUKey = false
Part.Gui.Label.ImageColor3 = Color3.fromRGB(255,255,255)
end
end)
|
--- Validates that the argument will work without any type errors.
|
function Argument:Validate(isFinal)
if self.RawValue == nil or #self.RawValue == 0 and self.Required == false then
return true
end
if self.Required and (self.RawSegments[1] == nil or #self.RawSegments[1] == 0) then
return false, "This argument is required."
end
if self.Type.Validate or self.Type.ValidateOnce then
for i = 1, #self.TransformedValues do
if self.Type.Validate then
local valid, errorText = self.Type.Validate(self:GetTransformedValue(i))
if not valid then
return valid, errorText or "Invalid value"
end
end
if isFinal and self.Type.ValidateOnce then
local validOnce, errorTextOnce = self.Type.ValidateOnce(self:GetTransformedValue(i))
if not validOnce then
return validOnce, errorTextOnce
end
end
end
return true
else
return true
end
end
|
-- ================================================================================
-- GUI BUTTON FUNCTIONS
-- ================================================================================
|
local function EnterFreeFlight()
-- Hide current window
hide()
-- Set selected game mode
SelectedMode.Value = "FreeFlight"
-- Show selection window
SelectionFrame.Visible = true
end
local function EnterRace()
-- Hide current window
hide()
-- Set selected game mode
SelectedMode.Value = "Racing"
-- Show selections window
SelectionFrame.Visible = true
end
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 20 -- cooldown for use of the tool again
ZoneModelName = "Dust star" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- As far as is known, the functions in this library are foolproof.
-- It cannot be fooled by a fake value that looks like a real one.
-- If it says a value is a CFrame, then it _IS_ a CFrame, period.
|
local lib = {}
local function set(object, property, value)
-- Sets the 'property' property of 'object' to 'value'.
-- This is used with pcall to avoid creating functions needlessly.
object[property] = value
end
function lib.isAnInstance(value)
-- Returns whether 'value' is an Instance value.
local _, result = pcall(Game.IsA, value, 'Instance')
return result == true
end
function lib.isALibrary(value)
-- Returns whether 'value' is a RbxLibrary.
-- Finds its result by checking whether the value's GetApi function (if it has one) can be dumped (and therefore is a non-Lua function).
if pcall(function() assert(type(value.GetApi) == 'function') end) then -- Check if the value has a GetApi function.
local success, result = pcall(string.dump, value.GetApi) -- Try to dump the GetApi function.
return result == "unable to dump given function" -- Return whether the GetApi function could be dumped.
end
return false
end
function lib.isAnEnum(value)
-- Returns whether the value is an enum.
return pcall(Enum.Material.GetEnumItems, value) == true
end
function lib.coerceIntoEnum(value, enum)
-- Coerces a value into an enum item, if possible, throws an error otherwise.
if lib.isAnEnum(enum) then
for _, enum_item in next, enum:GetEnumItems() do
if value == enum_item or value == enum_item.Name or value == enum_item.Value then return enum_item end
end
else
error("The 'enum' argument must be an enum.", 2)
end
error("The value cannot be coerced into a enum item of the specified type.", 2)
end
function lib.isOfEnumType(value, enum)
-- Returns whether 'value' is coercible into an enum item of the type 'enum'.
if lib.isAnEnum(enum) then
return pcall(lib.coerceIntoEnum, value, enum) == true
else
error("The 'enum' argument must be an enum.", 2)
end
end
local Color3Value = Instance.new('Color3Value')
function lib.isAColor3(value)
-- Returns whether 'value' is a Color3 value.
return pcall(set, Color3Value, 'Value', value) == true
end
local CFrameValue = Instance.new('CFrameValue')
function lib.isACoordinateFrame(value)
-- Returns whether 'value' is a CFrame value.
return pcall(set, CFrameValue, 'Value', value) == true
end
local BrickColor3Value = Instance.new('BrickColorValue')
function lib.isABrickColor(value)
-- Returns whether 'value' is a BrickColor value.
return pcall(set, BrickColor3Value, 'Value', value) == true
end
local RayValue = Instance.new('RayValue')
function lib.isARay(value)
-- Returns whether 'value' is a Ray value.
return pcall(set, RayValue, 'Value', value) == true
end
local Vector3Value = Instance.new('Vector3Value')
function lib.isAVector3(value)
-- Returns whether 'value' is a Vector3 value.
return pcall(set, Vector3Value, 'Value', value) == true
end
function lib.isAVector2(value)
-- Returns whether 'value' is a Vector2 value.
return pcall(function() return Vector2.new() + value end) == true
end
local FrameValue = Instance.new('Frame')
function lib.isAUdim2(value)
-- Returns whether 'value' is a UDim2 value.
return pcall(set, FrameValue, 'Position', value) == true
end
function lib.isAUDim(value)
-- Returns whether 'value' is a UDim value.
return pcall(function() return UDim.new() + value end) == true
end
local ArcHandleValue = Instance.new('ArcHandles')
function lib.isAAxis(value)
-- Returns whether 'value' is an Axes value.
return pcall(set, ArcHandleValue, 'Axes', value) == true
end
local FaceValue = Instance.new('Handles')
function lib.isAFace(value)
-- Returns whether 'value' is a Faces value.
return pcall(set, FaceValue, 'Faces', value) == true
end
function lib.isASignal(value)
-- Returns whether 'value' is a RBXScriptSignal.
local success, connection = pcall(function() return Game.AllowedGearTypeChanged.connect(value) end)
if success and connection then
connection:disconnect()
return true
end
end
function lib.getType(value)
-- Returns the most specific obtainable type of a value it can.
-- Useful for error messages or anything that is meant to be shown to the user.
local valueType = type(value)
if valueType == 'userdata' then
if lib.isAnInstance(value) then return value.ClassName
elseif lib.isAColor3(value) then return 'Color3'
elseif lib.isACoordinateFrame(value) then return 'CFrame'
elseif lib.isABrickColor(value) then return 'BrickColor'
elseif lib.isAUDim2(value) then return 'UDim2'
elseif lib.isAUDim(value) then return 'UDim'
elseif lib.isAVector3(value) then return 'Vector3'
elseif lib.isAVector2(value) then return 'Vector2'
elseif lib.isARay(value) then return 'Ray'
elseif lib.isAnEnum(value) then return 'Enum'
elseif lib.isASignal(value) then return 'RBXScriptSignal'
elseif lib.isALibrary(value) then return 'RbxLibrary'
elseif lib.isAAxis(value) then return 'Axes'
elseif lib.isAFace(value) then return 'Faces'
end
else
return valueType;
end
end
function lib.isAnInt(value)
-- Returns whether 'value' is an interger or not
return type(value) == "number" and value % 1 == 1;
end
function lib.isPositiveInt(number)
-- Returns whether 'value' is a positive interger or not.
-- Useful for money transactions, and is used in the method isAnArray ( )
return type(value) == "number" and number > 0 and math.floor(number) == number
end
function lib.isAnArray(value)
-- Returns if 'value' is an array or not
if type(value) == "table" then
local maxNumber = 0;
local totalCount = 0;
for index, _ in next, value do
if lib.isPositiveInt(index) then
maxNumber = math.max(maxNumber, index)
totalCount = totalCount + 1
else
return false;
end
end
return maxNumber == totalCount;
else
return false;
end
end
return lib
|
-- Hook events
|
Entry.TextBox.FocusLost:Connect(
function(submit)
return Window:LoseFocus(submit)
end
)
UserInputService.InputBegan:Connect(
function(input, gameProcessed)
return Window:BeginInput(input, gameProcessed)
end
)
Entry.TextBox:GetPropertyChangedSignal("Text"):Connect(
function()
if Entry.TextBox.Text:match("\t") then -- Eat \t
Entry.TextBox.Text = Entry.TextBox.Text:gsub("\t", "")
return
end
if Window.OnTextChanged then
Gui.CanvasPosition = Vector2.new(0, math.clamp(Gui.CanvasSize.Height.Offset - 300, 0, math.huge))
return Window.OnTextChanged(Entry.TextBox.Text)
end
end
)
Gui.ChildAdded:Connect(Window.UpdateWindowHeight)
return Window
|
-- When key pressed
|
function onKeyDown(key)
if key == nil then return end
key = key:lower()
-- Coaxial Machine Gun Control
if key == 'f' then
if firingMg then return end
firingMg = true;
while firingMg do
if not fireCoax() then
firingMg = false;
wait()
end
updateAmmo();
end
end
-- Switch ammo type
if key == 'e' then
parts.Engine.BodyGyro.MaxTorque = Vector3.new(0,0,100)
print("Flipping Vehicle")
wait(5)
parts.Engine.BodyGyro.MaxTorque = Vector3.new(0,0,0)
end
if key == 'q' then
if braking then return end
braking = true;
while braking do
if not Brakes() then
braking = false;
end
updateAmmo();
end
end
end
|
--------------| SYSTEM SETTINGS |--------------
|
Prefix = ";"; -- The character you use before every command (e.g. ';jump me').
SplitKey = " "; -- The character inbetween command arguments (e.g. setting it to '/' would change ';jump me' to ';jump/me').
BatchKey = ""; -- The character inbetween batch commands (e.g. setting it to '|' would change ';jump me ;fire me ;smoke me' to ';jump me | ;fire me | ;smoke me'
QualifierBatchKey = ","; -- The character used to split up qualifiers (e.g. ;jump player1,player2,player3)
Theme = "Blue"; -- The default UI theme.
NoticeSoundId = 2865227271; -- The SoundId for notices.
NoticeVolume = 0.1; -- The Volume for notices.
NoticePitch = 1; -- The Pitch/PlaybackSpeed for notices.
ErrorSoundId = 2865228021; -- The SoundId for error notifications.
ErrorVolume = 0.1; -- The Volume for error notifications.
ErrorPitch = 1; -- The Pitch/PlaybackSpeed for error notifications.
AlertSoundId = 3140355872; -- The SoundId for alerts.
AlertVolume = 0.5; -- The Volume for alerts.
AlertPitch = 1; -- The Pitch/PlaybackSpeed for alerts.
WelcomeBadgeId = 0; -- Award new players a badge, such as 'Welcome to the game!'. Set to 0 for no badge.
CommandDebounce = true; -- Wait until the command effect is over to use again. Helps to limit abuse & lag. Set to 'false' to disable.
SaveRank = true; -- Saves a player's rank in the server they received it. (e.g. ;rank plrName rank). Use ';permRank plrName rank' to permanently save a rank. Set to 'false' to disable.
LoopCommands = 2; -- The minimum rank required to use LoopCommands.
MusicList = {505757009,}; -- Songs which automatically appear in a user's radio. Type '!radio' to display the radio.
ThemeColors = { -- The colours players can set their HD Admin UI (in the 'Settings' menu). | Format: {ThemeName, ThemeColor3Value};
{"Red", Color3.fromRGB(150, 0, 0), };
{"Orange", Color3.fromRGB(150, 75, 0), };
{"Brown", Color3.fromRGB(120, 80, 30), };
{"Yellow", Color3.fromRGB(130, 120, 0), };
{"Green", Color3.fromRGB(0, 120, 0), };
{"Blue", Color3.fromRGB(0, 100, 150), };
{"Purple", Color3.fromRGB(100, 0, 150), };
{"Pink", Color3.fromRGB(150, 0, 100), };
{"Black", Color3.fromRGB(60, 60, 60), };
};
Colors = { -- The colours for ChatColors and command arguments. | Format: {"ShortName", "FullName", Color3Value};
{"r", "Red", Color3.fromRGB(255, 0, 0) };
{"o", "Orange", Color3.fromRGB(250, 100, 0) };
{"y", "Yellow", Color3.fromRGB(255, 255, 0) };
{"g", "Green" , Color3.fromRGB(0, 255, 0) };
{"dg", "DarkGreen" , Color3.fromRGB(0, 125, 0) };
{"b", "Blue", Color3.fromRGB(0, 255, 255) };
{"db", "DarkBlue", Color3.fromRGB(0, 50, 255) };
{"p", "Purple", Color3.fromRGB(150, 0, 255) };
{"pk", "Pink", Color3.fromRGB(255, 85, 185) };
{"bk", "Black", Color3.fromRGB(0, 0, 0) };
{"w", "White", Color3.fromRGB(255, 255, 255) };
};
ChatColors = { -- The colour a player's chat will appear depending on their rank. '["Owner"] = "Yellow";' makes the owner's chat yellow.
[5] = "Yellow";
};
Cmdbar = 4; -- The minimum rank required to use the Cmdbar.
Cmdbar2 = 2; -- The minimum rank required to use the Cmdbar2.
ViewBanland = 3; -- The minimum rank required to view the banland.
OnlyShowUsableCommands = true; -- Only display commands equal to or below the user's rank on the Commands page.
RankRequiredToViewPage = { -- || The pages on the main menu ||
["Commands"] = 2;
["Administrator"] =2;
["Settings"] = 2;
};
RankRequiredToViewRank = { -- || The rank categories on the 'Ranks' subPage under Admin ||
["Owner"] = 2;
["HeadAdmin"] = 2;
["Admin"] = 2;
["Mod"] = 2;
["VIP"] = 2;
};
RankRequiredToViewRankType = { -- || The collection of loader-rank-rewarders on the 'Ranks' subPage under Admin ||
["Owner"] = 2;
["SpecificUsers"] = 5;
["Gamepasses"] = 2;
["Assets"] = 2;
["Groups"] = 2;
["Friends"] = 2;
["FreeAdmin"] = 2;
["VipServerOwner"] = 2;
};
RankRequiredToViewIcon = 2;
WelcomeRankNotice = false; -- The 'You're a [rankName]' notice that appears when you join the game. Set to false to disable.
WelcomeDonorNotice = false; -- The 'You're a Donor' notice that appears when you join the game. Set to false to disable.
WarnIncorrectPrefix = false; -- Warn the user if using the wrong prefix | "Invalid prefix! Try using [correctPrefix][commandName] instead!"
DisableAllNotices = true; -- Set to true to disable all HD Admin notices.
ScaleLimit = 4; -- The maximum size players with a rank lower than 'IgnoreScaleLimit' can scale theirself. For example, players will be limited to ;size me 4 (if limit is 4) - any number above is blocked.
IgnoreScaleLimit = 3; -- Any ranks equal or above this value will ignore 'ScaleLimit'
CommandLimits = { -- Enables you to set limits for commands which have a number argument. Ranks equal to or higher than 'IgnoreLimit' will not be affected by Limit.
["fly"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["fly2"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["noclip"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["noclip2"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["speed"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["jumpPower"] = {
Limit = 10000;
IgnoreLimit = 3;
};
};
CommandLimitPerMinute = 60; -- Command limit per admin per minute
IgnoreCommandLimitPerMinute = 4; -- Rank requires to ignore limit
VIPServerCommandBlacklist = {"permRank", "permBan", "globalAnnouncement"}; -- Commands players are probihited from using in VIP Servers.
GearBlacklist = {67798397, 1055299}; -- The IDs of gear items to block when using the ;gear command.
IgnoreGearBlacklist = 4; -- The minimum rank required to ignore the gear blacklist.
PlayerDataStoreVersion = "V1.0"; -- Data about the player (i.e. permRanks, custom settings, etc). Changing the Version name will reset all PlayerData.
SystemDataStoreVersion = "V1.0"; -- Data about the game (i.e. the banland, universal message system, etc). Changing the Version name will reset all SystemData.
CoreNotices = { -- Modify core notices. You can find a table of all CoreNotices under [MainModule > Client > SharedModules > CoreNotices]
--NoticeName = NoticeDetails;
};
ChatVoiceAutoEnabled = true;
ChatVoiceRequiredRank = 0;
|
-- Constants for SHA3
|
do
local sh_reg = 29
local function next_bit()
local r = sh_reg % 2
sh_reg = bit32_bxor((sh_reg - r) / 2, 142 * r)
return r
end
for idx = 1, 24 do
local lo, m = 0, nil
for _ = 1, 6 do
m = m and m * m * 2 or 1
lo = lo + next_bit() * m
end
local hi = next_bit() * m
sha3_RC_hi[idx], sha3_RC_lo[idx] = hi, lo + hi * hi_factor_keccak
end
end
|
-- Tween variables
|
local tweenInfo = TweenInfo.new(
TWEEN_TIME, -- Time
Enum.EasingStyle.Quad, -- EasingStyle
Enum.EasingDirection.InOut, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true -- Reverses (tween will reverse once reaching its goal)
)
local function startTween()
-- If the part is already tweening, prevent it from starting a new tween
if inTween == true then
return
end
-- Calculate new CFrame for part position
local offsetCFrame = CFrame.new(0, TWEEN_MOVE_DISTANCE, 0)
local newCFrame = partToTween.CFrame:ToWorldSpace(offsetCFrame)
-- Create a tween and play it
local tweenPart = TweenService:Create(partToTween, tweenInfo, {CFrame = newCFrame})
tweenPart:Play()
inTween = true
-- On tween completion, make part ready for another tween
tweenPart.Completed:Connect(function()
inTween = false
end)
end
startTween() -- Start the animation
|
-- 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"},
["forcedIconSize"] = {},
["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"] = {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 then
if starterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList) then
starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
end
IconController._bringBackPlayerlist = (IconController._bringBackPlayerlist and IconController._bringBackPlayerlist + 1) or 1
self._bringBackPlayerlist = true
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
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
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.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 = {}
-- 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._draggingFinger then
return false
elseif self.isSelected then
self:deselect()
return true
end
self:select()
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.locked 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 then
if self.isSelected then
self:deselect()
else
self:select()
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
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
|
function onSwimming(speed)
if speed > 1.00 then
local scale = 10.0
playAnimation("swim", 0.4, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Swimming"
else
playAnimation("swimidle", 0.4, Humanoid)
pose = "Standing"
end
end
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
local lastTick = 0
function stepAnimate(currentTime)
local amplitude = 1
local frequency = 1
local deltaTime = currentTime - lastTick
lastTick = currentTime
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
elseif (pose == "Seated") then
playAnimation("sit", 0.5, Humanoid)
return
elseif (pose == "Running") then
playAnimation("walk", 0.2, Humanoid)
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
-- Tool Animation handling
local tool = Character:FindFirstChildOfClass("Tool")
end
|
--[[
Loadin'
Dem
Stats
--]]
|
game.Players.PlayerAdded:connect(function(player)
local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats")
player:WaitForChild("leaderstats")
wait(1)
local stats = player:FindFirstChild("leaderstats"):GetChildren()
for i = 1, #stats do
stats[i].Value = datastore:GetAsync(stats[i].Name)
print("stat numba "..i.." has been found")
end
end)
|
--[[**
Links several instances to a janitor, which is then returned.
@param [t:...Instance] ... All the instances you want linked.
@returns [t:Janitor] A janitor that can be used to manually disconnect all LinkToInstances.
**--]]
|
function Janitor.__index:LinkToInstances(...)
local ManualCleanup = Janitor.new()
for _, Object in ipairs({...}) do
ManualCleanup:Add(self:LinkToInstance(Object, true), "Disconnect")
end
return ManualCleanup
end
return Janitor
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed using client.Functions.GetRandom()
|
return function(data)
local gui = service.New("ScreenGui")
local mode = data.Mode
local gTable = client.UI.Register(gui, {Name = "Effect"})
local BindEvent = gTable.BindEvent
client.UI.Remove("Effect", gui)
gTable:Ready()
if mode == "Off" or not mode then
gTable:Destroy()
elseif mode == "Pixelize" then
local frame = Instance.new("Frame",gui)
local camera = workspace.CurrentCamera
local pixels = {}
local resY = data.Resolution or 20
local resX = data.Resolution or 20
local depth = 0
local distance = data.Distance or 80
local function renderScreen()
for i,pixel in pairs(pixels) do
local ray = camera:ScreenPointToRay(pixel.X,pixel.Y,depth)
local part, endPoint = workspace:FindPartOnRay(Ray.new(ray.Origin,ray.Direction*distance))
if part and part.Transparency < 1 then
pixel.Pixel.BackgroundColor3 = part.BrickColor.Color
else
pixel.Pixel.BackgroundColor3 = Color3.fromRGB(105, 170, 255)
end
end
end
frame.Size = UDim2.new(1,0,1,40)
frame.Position = UDim2.new(0,0,0,-35)
for y = 0,gui.AbsoluteSize.Y+50,resY do
for x = 0,gui.AbsoluteSize.X+30,resX do
local pixel = Instance.new("TextLabel")
pixel.Text = ""
pixel.BorderSizePixel = 0
pixel.Size = UDim2.new(0,resX,0,resY)
pixel.Position = UDim2.new(0,x-(resX/2),0,y-(resY/2))
pixel.BackgroundColor3 = Color3.fromRGB(105, 170, 255)
pixel.Parent = frame
table.insert(pixels,{Pixel = pixel,X = x, Y = y})
end
end
while wait() and not gTable.Destroyed and gui.Parent do
if not gTable.Destroyed and not gTable.Active then
wait(5)
else
renderScreen()
end
end
gTable:Destroy()
elseif mode == "FadeOut" then
service.StarterGui:SetCore("TopbarEnabled",false)
service.UserInputService.MouseIconEnabled = false
for i,v in pairs(service.PlayerGui:GetChildren()) do
pcall(function() if v~=gui then v:Destroy() end end)
end
local bg = Instance.new("Frame", gui)
bg.BackgroundTransparency = 1
bg.BackgroundColor3 = Color3.new(0,0,0)
bg.Size = UDim2.new(2,0,2,0)
bg.Position = UDim2.new(-0.5,0,-0.5,0)
for i = 1,0,-0.01 do
bg.BackgroundTransparency = i
wait(0.1)
end
bg.BackgroundTransparency = 0
client.Functions.BrickBlur(true,0,BrickColor.new("Really black"))
elseif mode == "Trippy" then
local v = service.Player
local bg = Instance.new("Frame", gui)
bg.BackgroundColor3 = Color3.new(0,0,0)
bg.BackgroundTransparency = 0
bg.Size = UDim2.new(10,0,10,0)
bg.Position = UDim2.new(-5,0,-5,0)
bg.ZIndex = 10
while gui and gui.Parent do
wait(1/44)
bg.BackgroundColor3 = Color3.new(math.random(255)/255,math.random(255)/255,math.random(255)/255)
end
if gui then gui:Destroy() end
elseif mode == "Spooky" then
local frame = Instance.new("Frame",gui)
frame.BackgroundColor3=Color3.new(0,0,0)
frame.Size=UDim2.new(1,0,1,50)
frame.Position=UDim2.new(0,0,0,-50)
local img = Instance.new("ImageLabel",frame)
img.Position = UDim2.new(0,0,0,0)
img.Size = UDim2.new(1,0,1,0)
img.BorderSizePixel = 0
img.BackgroundColor3 = Color3.new(0,0,0)
local textures = {
299735022;
299735054;
299735082;
299735103;
299735133;
299735156;
299735177;
299735198;
299735219;
299735245;
299735269;
299735289;
299735304;
299735320;
299735332;
299735361;
299735379;
}
local sound = Instance.new("Sound",gui)
sound.SoundId = "rbxassetid://174270407"
sound.Looped = true
sound:Play()
while gui and gui.Parent do
for i=1,#textures do
img.Image = "rbxassetid://"..textures[i]
wait(0.1)
end
end
sound:Stop()
elseif mode == "lifeoftheparty" then
local frame = Instance.new("Frame",gui)
frame.BackgroundColor3 = Color3.new(0,0,0)
frame.Size = UDim2.new(1,0,1,50)
frame.Position = UDim2.new(0,0,0,-50)
local img = Instance.new("ImageLabel",frame)
img.Position = UDim2.new(0,0,0,0)
img.Size = UDim2.new(1,0,1,0)
img.BorderSizePixel = 0
img.BackgroundColor3 = Color3.new(0,0,0)
local textures = {
299733203;
299733248;
299733284;
299733309;
299733355;
299733386;
299733404;
299733425;
299733472;
299733489;
299733501;
299733523;
299733544;
299733551;
299733564;
299733570;
299733581;
299733597;
299733609;
299733621;
299733632;
299733640;
299733648;
299733663;
299733674;
299733694;
}
local sound = Instance.new("Sound",gui)
sound.SoundId = "rbxassetid://172906410"
sound.Looped = true
sound:Play()
while gui and gui.Parent do
for i=1,#textures do
img.Image = "rbxassetid://"..textures[i]
wait(0.1)
end
end
sound:Stop()
elseif mode == "Strobe" then
local bg = Instance.new("Frame", gui)
bg.BackgroundColor3 = Color3.new(0,0,0)
bg.BackgroundTransparency = 0
bg.Size = UDim2.new(10,0,10,0)
bg.Position = UDim2.new(-5,0,-5,0)
bg.ZIndex = 10
while gui and gui.Parent do
wait(1/44)
bg.BackgroundColor3 = Color3.new(1,1,1)
wait(1/44)
bg.BackgroundColor3 = Color3.new(0,0,0)
end
if gui then gui:Destroy() end
elseif mode == "Blind" then
local bg = Instance.new("Frame", gui)
bg.BackgroundColor3 = Color3.new(0,0,0)
bg.BackgroundTransparency = 0
bg.Size = UDim2.new(10,0,10,0)
bg.Position = UDim2.new(-5,0,-5,0)
bg.ZIndex = 10
elseif mode == "ScreenImage" then
local bg = Instance.new("ImageLabel", gui)
bg.Image="rbxassetid://"..data.Image
bg.BackgroundColor3 = Color3.new(0,0,0)
bg.BackgroundTransparency = 0
bg.Size = UDim2.new(1,0,1,0)
bg.Position = UDim2.new(0,0,0,0)
bg.ZIndex = 10
end
end
|
--M4 Variables
|
local m4 = script.Parent:WaitForChild("M4")
local m4Weld = m4:WaitForChild("M4 Weld")
local barrel = script.Parent:WaitForChild("Barrel")
local aimer = script.Parent:WaitForChild("Aimer")
local aimerWeld = aimer:WaitForChild("Aimer Weld")
|
--[[**
<description>
Saves the data to the data store. Called when a player leaves.
</description>
**--]]
|
function DataStore:Save()
local success, result = self:SaveAsync():await()
if success then
print("saved " .. self.Name)
else
error(result)
end
end
|
-- Function to play an audio asset
|
AudioPlayer.playAudio = function(asset)
if not asset then
warn("Could not find audio asset: " .. asset)
return
end
if not asset.IsLoaded then
asset.Loaded:wait()
end
asset:Play()
end
AudioPlayer.pauseAudio = function(asset)
if asset.IsPlaying then
AudioPlayer.reduceVolume(asset, 0)
asset:Pause()
end
end
AudioPlayer.resumeAudio = function(asset)
if asset.IsPaused then
asset:Resume()
AudioPlayer.increaseVolume(asset, 0.5)
end
end
AudioPlayer.reduceVolume = function(asset, goalVolume)
for i = asset.Volume, goalVolume, -0.02 do
asset.Volume = i
wait()
end
end
AudioPlayer.increaseVolume = function(asset, goalVolume)
for i = 0, goalVolume, 0.02 do
asset.Volume = i
wait()
end
end
AudioPlayer.getCurrentlyPlaying = function(assets)
for _, asset in ipairs(assets) do
if asset.IsPlaying then
return asset
end
end
end
AudioPlayer.getCurrentlyPaused = function(assets)
for _, asset in ipairs(assets) do
if asset.IsPaused and asset.TimePosition > 0 then
return asset
end
end
end
return AudioPlayer
|
--------END RIGHT DOOR --------
|
game.Workspace.post1.Light.BrickColor = BrickColor.new(133)
game.Workspace.post2.Light.BrickColor = BrickColor.new(133)
end
wait(0.15)
if game.Workspace.DoorFlashing.Value == true then
|
--------------------------CHARACTER CONTROL-------------------------------
|
local CurrentIgnoreList
local CurrentIgnoreTag = nil
local TaggedInstanceAddedConnection = nil
local TaggedInstanceRemovedConnection = nil
local function GetCharacter()
return Player and Player.Character
end
local function UpdateIgnoreTag(newIgnoreTag)
if newIgnoreTag == CurrentIgnoreTag then
return
end
if TaggedInstanceAddedConnection then
TaggedInstanceAddedConnection:Disconnect()
TaggedInstanceAddedConnection = nil
end
if TaggedInstanceRemovedConnection then
TaggedInstanceRemovedConnection:Disconnect()
TaggedInstanceRemovedConnection = nil
end
CurrentIgnoreTag = newIgnoreTag
CurrentIgnoreList = {GetCharacter()}
if CurrentIgnoreTag ~= nil then
local ignoreParts = CollectionService:GetTagged(CurrentIgnoreTag)
for _, ignorePart in ipairs(ignoreParts) do
table.insert(CurrentIgnoreList, ignorePart)
end
TaggedInstanceAddedConnection = CollectionService:GetInstanceAddedSignal(
CurrentIgnoreTag):Connect(function(ignorePart)
table.insert(CurrentIgnoreList, ignorePart)
end)
TaggedInstanceRemovedConnection = CollectionService:GetInstanceRemovedSignal(
CurrentIgnoreTag):Connect(function(ignorePart)
for i = 1, #CurrentIgnoreList do
if CurrentIgnoreList[i] == ignorePart then
CurrentIgnoreList[i] = CurrentIgnoreList[#CurrentIgnoreList]
table.remove(CurrentIgnoreList)
break
end
end
end)
end
end
local function getIgnoreList()
if CurrentIgnoreList then
return CurrentIgnoreList
end
CurrentIgnoreList = {}
table.insert(CurrentIgnoreList, GetCharacter())
return CurrentIgnoreList
end
|
--//Script
|
Plaka()
print(Stats.Plate.Value)
CarColor()
Stats.Locked.Changed:Connect(function()
ToogleLock(Stats.Locked.Value)
end)
Stats.Color.Changed:Connect(function()
CarColor()
end)
Fuel = script.Parent.Parent.Stats.Fuel
MainPart = script.Parent.Parent.Body.Main
while wait(.5) do
if oldpos == nil then
oldpos = MainPart.Position
else
newpos = MainPart.Position
Fuel.Value = Fuel.Value - (oldpos - newpos).Magnitude/150
oldpos = newpos
end
end
|
--[=[
http://reactivex.io/documentation/operators/just.html
```lua
Rx.of(1, 2, 3):Subscribe(print, function()
print("Complete")
end)) --> 1, 2, 3, "Complete"
```
@param ... any -- Arguments to emit
@return Observable
]=]
|
function Rx.of(...)
local args = table.pack(...)
return Observable.new(function(sub)
for i=1, args.n do
sub:Fire(args[i])
end
sub:Complete()
end)
end
|
-- Print version
|
print(gameRules.Version)
print("Ina's Ro-Combat Mod: Patch v1.2.3")
|
-- Place this script in a LocalScript
|
local toolName = "Him" -- The name of the tool to give
local tool = game.Workspace:FindFirstChild('Him')
|
--[[**
ensures value is NaN
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
function t.nan(value)
local valueType = typeof(value)
if valueType == "number" then
if value ~= value then
return true
else
return false, "unexpected non-NaN value"
end
else
return false, string.format("number expected, got %s", valueType)
end
end
|
--- DONT TOUCH ---
|
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local Values = script.Parent.Parent:WaitForChild("Values")
local car = script.Parent.Parent.Car.Value
local DriveSeat = car:WaitForChild("DriveSeat")
local Tune = require(car:WaitForChild("A-Chassis Tune"))
local IsOn = Values.Parent:WaitForChild("IsOn")
local LightEvent = car:WaitForChild("LightEvent")
local LI = script.Values.Left
local RI = script.Values.Right
local H = script.Values.Hazard
local RL = script.Values.RunningLights
local HL = script.Values.Headlights
local setup = false
local current_seq_seg = 1
local flashing = false
local parklightActive = false
local fogActive = false
local popupsActive = false
local gui_tweeninfo = TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)
local indgui_tweeninfo = TweenInfo.new(Indicator_Flash_Rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)
function input(key, gameprocessed)
if not gameprocessed then
if key.KeyCode == Headlights then
if HL.Value == 0 then
HL.Value = 1
LightEvent:FireServer("Headlights", Low_Beam_Brightness, 0.2, 48, parklightActive, Popups_Enabled, Headlight_Type, HL.Value)
LightEvent:FireServer("RearLights", Rear_Light_Type, Rear_Light_Brightness, 0.2, Trunk_Lights)
if fogActive then
LightEvent:FireServer("FogLights", Fog_Light_Brightness, 0.02, Fog_Light_Type)
TweenService:Create(script.Parent.FogLights, gui_tweeninfo, {ImageTransparency = 0}):Play()
end
TweenService:Create(script.Parent.LowBeams, gui_tweeninfo, {ImageTransparency = 0}):Play()
elseif HL.Value == 1 then
HL.Value = 2
LightEvent:FireServer("Headlights", High_Beam_Brightness, 0.02, 60, parklightActive, Popups_Enabled, Headlight_Type, HL.Value)
TweenService:Create(script.Parent.LowBeams, gui_tweeninfo, {ImageTransparency = 1}):Play()
TweenService:Create(script.Parent.HighBeams, gui_tweeninfo, {ImageTransparency = 0}):Play()
elseif HL.Value == 2 then
HL.Value = 0
LightEvent:FireServer("Headlights", 0, 1, 60, parklightActive, Popups_Enabled, Headlight_Type, HL.Value)
LightEvent:FireServer("RearLights", Rear_Light_Type, 0, 1, Trunk_Lights)
LightEvent:FireServer("FogLights", 0, 1, Fog_Light_Type)
TweenService:Create(script.Parent.LowBeams, gui_tweeninfo, {ImageTransparency = 1}):Play()
TweenService:Create(script.Parent.HighBeams, gui_tweeninfo, {ImageTransparency = 1}):Play()
TweenService:Create(script.Parent.FogLights, gui_tweeninfo, {ImageTransparency = 1}):Play()
end
if Plate_Lights then
if HL.Value >= 1 then
LightEvent:FireServer("PlateLights", true, Plate_Light_Type)
else
LightEvent:FireServer("PlateLights", false, Plate_Light_Type)
end
end
elseif key.KeyCode == Popups then
if Popups_Enabled then
if popupsActive == false then
LightEvent:FireServer("Popups", true, Popups_Enabled, Popup_Hinge_Angle)
popupsActive = true
else
LightEvent:FireServer("Popups", false, Popups_Enabled, Popup_Hinge_Angle)
popupsActive = false
end
end
elseif key.KeyCode == RunningLights then
if not parklightActive then
parklightActive = true
TweenService:Create(script.Parent.ParkLights, gui_tweeninfo, {ImageTransparency = 0}):Play()
else
parklightActive = false
TweenService:Create(script.Parent.ParkLights, gui_tweeninfo, {ImageTransparency = 1}):Play()
end
if HL.Value == 0 then
LightEvent:FireServer("Headlights", 0, 1, 60, parklightActive, Popups_Enabled, Headlight_Type, HL.Value)
end
elseif key.KeyCode == FogLights then
if HL.Value > 0 then
if not fogActive then
LightEvent:FireServer("FogLights", Fog_Light_Brightness, 0.02, Fog_Light_Type)
TweenService:Create(script.Parent.FogLights, gui_tweeninfo, {ImageTransparency = 0}):Play()
fogActive = true
else
LightEvent:FireServer("FogLights", 0, 1, Fog_Light_Type)
TweenService:Create(script.Parent.FogLights, gui_tweeninfo, {ImageTransparency = 1}):Play()
fogActive = false
end
else
if not fogActive then
fogActive = true
else
fogActive = false
end
end
elseif key.KeyCode == Flash then
if not flashing then
end
elseif key.KeyCode == SignalLeft then
if not LI.Value then
LI.Value = true
script.StackOn:Play()
else
LI.Value = false
script.StackOff:Play()
end
elseif key.KeyCode == SignalRight then
if not RI.Value then
RI.Value = true
script.StackOn:Play()
else
RI.Value = false
script.StackOff:Play()
end
elseif key.KeyCode == Hazards then
if not H.Value then
H.Value = true
else
H.Value = false
end
end
end
end
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 5 -- cooldown for use of the tool again
ZoneModelName = "String broke reality" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- << FUNCTIONS >>
|
function module:InsertStat(key, statName, value, specificData)
if updating and not specificData then repeat wait(0.1) until not updating end
key = tostring(key)
if specificData then
table.insert(specificData[statName], value)
specificData.DataToUpdate = true
else
table.insert(main.sd[key][statName], value)
main.sd[key].DataToUpdate = true
end
end
function module:ChangeStat(key, statName, newValue)
if updating then repeat wait(0.1) until not updating end
main.sd[key][statName] = newValue
main.sd[key].DataToUpdate = true
end
|
--Services
|
local Players = game:GetService("Players")
|
-- This function actually creates the weld.
|
function CreateWeld(x, y)
local weld = Instance.new("Weld")
weld.Part0 = x
weld.Part1 = y
weld.C0 = x.CFrame:inverse() * x.CFrame
weld.C1 = y.CFrame:inverse() * x.CFrame
weld.Parent = x
return weld
end
|
--Enter the name of the model you want to go to here.
------------------------------------
|
modelname="Head"
|
--------[LOCAL FUNCTIONS]--------
----[UPDATE SLIDER POSITIONS]----
|
local function RGBSliderMovement(MouseX, z, i) --z = ColorPicker, i = RGBSlider
if MouseX > (RGBSliderHitboxes[z][i].AbsolutePosition.X) and MouseX < (RGBSliderHitboxes[z][i].AbsolutePosition.X + RGBSliderHitboxes[z][i].AbsoluteSize.X) then
RGBSliders[z][i].Position = UDim2.new(0, MouseX - RGBSliderHitboxes[z][i].AbsolutePosition.X, RGBSliders[z][i].Position.Y.Scale, 0)
elseif MouseX < (RGBSliderHitboxes[z][i].AbsolutePosition.X) then
RGBSliders[z][i].Position = UDim2.new(0, 0, RGBSliders[z][i].Position.Y.Scale, 0)
elseif MouseX > (RGBSliderHitboxes[z][i].AbsolutePosition.X + RGBSliderHitboxes[z][i].AbsoluteSize.X) then
RGBSliders[z][i].Position = UDim2.new(0, RGBSliderHitboxes[z][i].AbsoluteSize.X + 1, RGBSliders[z][i].Position.Y.Scale, 0)
end
RGBInputs[z][i].Text = math.floor(((RGBSliders[z][i].Position.X.Offset / RGBSliderHitboxes[z][i].AbsoluteSize.X) * 255))
PreviewColor[z].BackgroundColor3 = Color3.fromRGB(tonumber(RGBInputs[z][1].Text), tonumber(RGBInputs[z][2].Text), tonumber(RGBInputs[z][3].Text))
end
|
--[[local gui = Instance.new("ScreenGui")
local bg = Instance.new("Frame",gui)
local bar = Instance.new("Frame",bg)
local bvl = Instance.new("ImageLabel", bg)
bvl.Name = "Bevel"
bvl.BackgroundTransparency = 1
bvl.Image = "http://www.roblox.com/asset/?id=56852431"
bvl.Size = UDim2.new(1,0,1,0)
bg.Name = "Back"
bar.Name = "Charge"
bar.BackgroundColor3 = Color3.new(200/255,0/255,0/255)
bg.BackgroundColor3 = Color3.new(200/255,200/255,200/255)
bg.Size = UDim2.new(0,10,0,-100)
bg.Position = UDim2.new(0,5,0,500)
bar.Size = UDim2.new(0,4,-1,0)
bar.Position = UDim2.new(0,3,1,0)
ggui = gui:Clone()
ggui.Name = "GunGui"
ggui.Back.Charge.Size = UDim2.new(0,4,-(script.Charge.Value/100),0)]]
|
GroupID = 9999
function AntiGH(char1,char2)
if GH then
local plyr1 = game.Players:findFirstChild(char1.Name)
local plyr2 = game.Players:findFirstChild(char2.Name)
if plyr1 and plyr2 then
if plyr1:IsInGroup(GroupID) and plyr2:IsInGroup(GroupID) then
return false
end
end
return true
elseif not GH then
return true
end
end
MaxDist = 1000
function RayCast(Start,End,Ignore)
if WallShoot then
ray1 = Ray.new(Start, End.unit * 999.999)
local Part1, TempPos = Workspace:FindPartOnRay(ray1,Ignore)
ray2 = Ray.new(TempPos, End.unit * 999.999)
local Part2, EndPos = Workspace:FindPartOnRay(ray2,Part1)
return Part1, Part2, EndPos
elseif not WallShoot then
ray = Ray.new(Start, End.unit * 999.999)
return Workspace:FindPartOnRay(ray,Ignore)
end
end
function DmgPlr(Part)
if Part ~= nil then
local c = Instance.new("ObjectValue")
c.Name = "creator"
c.Value = game.Players:findFirstChild(script.Parent.Parent.Name)
local hum = Part.Parent:findFirstChild("Humanoid")
local hathum = Part.Parent.Parent:findFirstChild("Humanoid")
local hat = Part.Parent
if hathum ~= nil and hat:IsA("Hat") and AntiGH(hathum.Parent, script.Parent.Parent) then
hathum:TakeDamage(Damage/1)
Part.Parent = game.Workspace
Part.CFrame = CFrame.new(Part.Position + Vector3.new(math.random(-5,5),math.random(-5,5),math.random(-5,5)))
hat:Remove()
c.Parent = hathum
game.Debris:AddItem(c,1.5)
elseif hum ~= nil and AntiGH(hum.Parent, script.Parent.Parent) then
if Part.Name == "Head" then
hum:TakeDamage(Damage*1.3)
end
hum:TakeDamage(Damage)
c.Parent = hum
game.Debris:AddItem(c,1.5)
end
end
end
function onButton1Down(mouse)
if script.Parent.Ammo.Value == 0 then
else
if GunType == 0 then
if (not enabled) then return end
enabled = false
LaserShoot(mouse)
if Flash then
script.Parent.Barrel.Light.Light.Visible = true
end
script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
wait(0.01)
if Flash then
script.Parent.Barrel.Light.Light.Visible = false
end
wait(1/SPS)
enabled = true
elseif GunType == 1 then
automatichold = true
while automatichold == true and script.Parent.Ammo.Value ~= 0 do wait()
if (not enabled) then return end
if script.Parent.Parent:findFirstChild("Humanoid").Health == 0 then script.Parent:Remove() end
enabled = false
LaserShoot(mouse)
if Flash then
script.Parent.Barrel.Light.Light.Visible = true
end
script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
wait(0.01)
if Flash then
script.Parent.Barrel.Light.Light.Visible = false
end
wait(1/SPS)
enabled = true
end
end
end
end
function LaserShoot(mouse)
hit = mouse.Hit.p
local StartPos = script.Parent.Barrel.CFrame.p
local rv = (StartPos-hit).magnitude/(Recoil * 20)
local rcl = Vector3.new(math.random(-rv,rv),math.random(-rv,rv),math.random(-rv,rv))
aim = hit + rcl
local P = Instance.new("Part")
P.Name = "Bullet"
P.formFactor = 3
P.BrickColor = BrickColor.new(BulletColor)
P.Size = Vector3.new(1,1,1)
P.Anchored = true
P.CanCollide = false
P.Transparency = 0.5
P.Parent = script.Parent.Parent
local m = Instance.new("CylinderMesh")
m.Name = "Mesh"
m.Parent = P
local c = Instance.new("ObjectValue")
c.Name = "creator"
c.Value = game.Players:findFirstChild(script.Parent.Parent.Name)
pewsound = script:FindFirstChild("Fire")
if pewsound then
pewsound:Play()
end --Brick created. Moving on to next part
local SPos = script.Parent.Barrel.CFrame.p
if WallShoot then
local Part1, Part2, EndPos = RayCast(SPos, (aim-SPos).unit * 999, script.Parent.Parent)
DmgPlr(Part1)
DmgPlr(Part2)
if Part1 and Part2 then
local enddist = (EndPos-SPos).magnitude
P.CFrame = CFrame.new(EndPos, SPos) * CFrame.new(0,0,-enddist/2) * CFrame.Angles(math.rad(90),0,0)
m.Scale = Vector3.new(.04,enddist,.04)
else
P.CFrame = CFrame.new(EndPos, SPos) * CFrame.new(0,0,-MaxDist/2) * CFrame.Angles(math.rad(90),0,0)
m.Scale = Vector3.new(.04,MaxDist,.04)
end
elseif not WallShoot then
local Part, Pos = RayCast(SPos, (aim-SPos).unit * 999, script.Parent.Parent)
DmgPlr(Part)
if Part then
local dist = (Pos-SPos).magnitude
P.CFrame = CFrame.new(Pos, SPos) * CFrame.new(0,0,-dist/2) * CFrame.Angles(math.rad(90),0,0)
m.Scale = Vector3.new(.1,dist,.1)
else
P.CFrame = CFrame.new(Pos, SPos) * CFrame.new(0,0,-MaxDist/2) * CFrame.Angles(math.rad(90),0,0)
m.Scale = Vector3.new(.1,MaxDist,.1)
end
end
game.Debris:AddItem(P,.1)
end
function onButton1Up(mouse)
automatichold = false
end
function onKeyDown(key, mouse)
if key:lower() == "r" then
if script.Parent.Ammo.Value ~= script.Parent.MaxAmmo.Value then
reloadsound = script:FindFirstChild("Reload")
if reloadsound then
reloadsound:Play()
end
enabled = false
script.Parent.VisibleB.Value = true
script.Parent.StringValue.Value = "Reloading"
repeat script.Parent.StringValue.Value = "Reloading" wait(0.3) script.Parent.Ammo.Value = script.Parent.Ammo.Value + 3 script.Parent.StringValue.Value = "Reloading" until script.Parent.Ammo.Value >= script.Parent.MaxAmmo.Value
script.Parent.Ammo.Value = script.Parent.MaxAmmo.Value
wait(0.2)
script.Parent.VisibleB.Value = false
enabled = true
end
end
if key:lower() == "m" then
if GunType == 0 then
GunType = 0
Recoil = 3
else
GunType = 1
Recoil = 3
end
end
end
function onEquipped(mouse)
equipped = true
if mouse == nil then
print("Mouse not found")
return
end
mouse.Icon = "http://www.roblox.com/asset/?id=52812029"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
end
function onUnequipped(mouse)
equipped = false
automatichold = false
end
script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:connect(onUnequipped)
while true do wait()
if script.Parent.Ammo.Value == 0 then
script.Parent.VisibleB.Value = true
script.Parent.StringValue.Value = "Reload"
end
if GunType == 1 then
script.Parent.ModeText.Value = "Auto"
else
script.Parent.ModeText.Value = "Semi"
end
end
|
--Sound variables
|
local runningSound = myHead.Running
local jumpingSound = myHead.Jumping
local hurtSound = myHead.Hurt
local diedSound = myHead.Died
myHuman:SetStateEnabled(Enum.HumanoidStateType.Flying,false)
myHuman:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
myHuman:SetStateEnabled(Enum.HumanoidStateType.Physics,false)
myHuman:SetStateEnabled(Enum.HumanoidStateType.Ragdoll,false)
myHuman:SetStateEnabled(Enum.HumanoidStateType.RunningNoPhysics,false)
myHuman:SetStateEnabled(Enum.HumanoidStateType.StrafingNoPhysics,false)
myHuman:SetStateEnabled(Enum.HumanoidStateType.Swimming,false)
local rotAttach1 = Instance.new("Attachment")
rotAttach1.Parent = workspace.Terrain
myHuman.Running:Connect(function(speed)
if speed>0 then
runningSound:Play()
else
runningSound:Stop()
end
end)
myHuman.Jumping:Connect(function()
jumpingSound:Play()
end)
if marine.Settings.PlayDeathAnimation.Value == true then
myHuman.BreakJointsOnDeath = false
end
myHuman.Died:Connect(function()
diedSound:Play()
actions.yieldM4()
actions.updateFace("Dead")
if marine.Settings.PlayDeathAnimation.Value == true then
myHuman.BreakJointsOnDeath = false
marine.HumanoidRootPart.Anchored = true
DeathAnimation:Play()
DeathAnimation.Stopped:Wait()
end
for i,v in ipairs(marine:GetDescendants()) do
if v:IsA("BallSocketConstraint") then
v.Enabled = true
elseif v:IsA("BasePart") and v.Name ~= "myHumanoidRootPart" then
v.CanCollide = false
elseif v:IsA("Motor6D") then
v:Destroy()
end
end
if marine.Settings.Respawn.Value then
wait(marine.Settings.RespawnDelay.Value)
clone.Parent = marine.Parent
ArmorDurability = MaxArmorDurability
end
for i,v in ipairs(marine:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("Decal") then
game:GetService("TweenService"):Create(v,TweenInfo.new(0.2),{Transparency = 1}):Play()
end
end
rotAttach1:Destroy()
wait(0.2)
marine:Destroy()
end)
local soundSpeeds = {0.9,0.95,1,1.05,1.1}
myHuman.HealthChanged:Connect(function(health)
if ArmorDurability > 0 then
local damageTaken = oldHealth - health
if (ArmorDurability - damageTaken) <= 0 then
ArmorDurability = 0
marine.Torso.ArmorBroken:Play()
local Info = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
local Properties1 = {BackgroundTransparency = 1}
local Properties2 = {ImageTransparency = 1}
ArmorFill.Size = UDim2.new(0, 0, 1, 0)
for i,v in pairs(ArmorGUI:GetDescendants()) do
if v:IsA("Frame") then
local Tween = TweenService:Create(v,Info,Properties1)
Tween:Play()
elseif v:IsA("ImageLabel") then
local Tween = TweenService:Create(v,Info,Properties2)
Tween:Play()
end
end
else
ArmorDurability -= damageTaken
ArmorFill.Size = UDim2.new((ArmorDurability / MaxArmorDurability) * 1, 0, 1, 0)
myHuman.Health = oldHealth
end
end
if health < oldHealth and hurtSound.IsPlaying == false then
status:set("tookDamage",true)
if math.random(3) == 1 then
hurtSound.PlaybackSpeed = soundSpeeds[math.random(#soundSpeeds)]
hurtSound:Play()
end
core.spawn(function()
actions.updateFace("Hurt")
wait(1)
if myHead:FindFirstChild("faceHurt") then
actions.updateFace(status:get("mood"),true)
end
end)
end
oldHealth = myHuman.Health
if myHuman.Health <= 0 then
combatModule.destroyBulletRelatedCopies()
local Info = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
local Properties1 = {BackgroundTransparency = 1}
local Properties2 = {ImageTransparency = 1}
HealthFill.Size = UDim2.new(0, 0, 1, 0)
for i,v in pairs(HealthGUI:GetDescendants()) do
if v:IsA("Frame") then
local Tween = TweenService:Create(v,Info,Properties1)
Tween:Play()
elseif v:IsA("ImageLabel") then
local Tween = TweenService:Create(v,Info,Properties2)
Tween:Play()
end
end
else
HealthFill.Size = UDim2.new((myHuman.Health / myHuman.MaxHealth) * 1, 0, 1, 0)
if myHuman.Health < 45 then
for i,v in pairs(HealthFrame:GetChildren()) do
if v.Name == "Borders" then
v.BackgroundColor3 = Color3.fromRGB(189, 63, 63)
end
end
HealthBar.BorderColor3 = Color3.fromRGB(189, 63, 63)
HealthFill.BackgroundColor3 = Color3.fromRGB(189, 63, 63)
HealthShading.BackgroundColor3 = Color3.fromRGB(194, 87, 87)
HealthFrame.ImageLabel.ImageColor3 = Color3.fromRGB(189, 63, 63)
else
for i,v in pairs(HealthFrame:GetChildren()) do
if v.Name == "Borders" then
v.BackgroundColor3 = Color3.fromRGB(0, 189, 0)
end
end
HealthBar.BorderColor3 = Color3.fromRGB(0, 189, 0)
HealthFill.BackgroundColor3 = Color3.fromRGB(0, 189, 0)
HealthShading.BackgroundColor3 = Color3.fromRGB(115, 189, 102)
HealthFrame.ImageLabel.ImageColor3 = Color3.fromRGB(0, 189, 0)
end
end
end)
|
--gyro.cframe = CFrame.new(char.Position,pos)
|
bpos.position = char.Position + (pos-char.Position).unit * power
wait()
end
end
function onMove(mouse)
pos = mouse.Hit.p
gyro.cframe = CFrame.new(char.Position,pos) * CFrame.fromEulerAnglesXYZ(-3.14/2+1.2,0,0)
|
-- A state object which follows another state object using tweens.
|
export type Tween<T> = StateObject<T> & Dependent & {
-- kind: "Tween" (add this when Luau supports singleton types)
}
|
--[[ PRIVATE FUNCTIONS ]]
|
--
local function declareError(self, errorType)
self._lastError = errorType
self._events.Error:Fire(errorType)
end
|
--Rescripted by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
Speed = 100
Duration = 1
NozzleOffset = Vector3.new(0, 0.4, -1.1)
Sounds = {
Fire = Handle:WaitForChild("Fire"),
Reload = Handle:WaitForChild("Reload"),
HitFade = Handle:WaitForChild("HitFade")
}
PointLight = Handle:WaitForChild("PointLight")
ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Tool
ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Tool
ServerControl.OnServerInvoke = (function(player, Mode, Value, arg)
if player ~= Player or Humanoid.Health == 0 or not Tool.Enabled then
return
end
if Mode == "Click" and Value then
Activated(arg)
end
end)
function InvokeClient(Mode, Value)
pcall(function()
ClientControl:InvokeClient(Player, Mode, Value)
end)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function FindCharacterAncestor(Parent)
if Parent and Parent ~= game:GetService("Workspace") then
local humanoid = Parent:FindFirstChild("Humanoid")
if humanoid then
return Parent, humanoid
else
return FindCharacterAncestor(Parent.Parent)
end
end
return nil
end
function GetTransparentsRecursive(Parent, PartsTable)
local PartsTable = (PartsTable or {})
for i, v in pairs(Parent:GetChildren()) do
local TransparencyExists = false
pcall(function()
local Transparency = v["Transparency"]
if Transparency then
TransparencyExists = true
end
end)
if TransparencyExists then
table.insert(PartsTable, v)
end
GetTransparentsRecursive(v, PartsTable)
end
return PartsTable
end
function SelectionBoxify(Object)
local SelectionBox = Instance.new("SelectionBox")
SelectionBox.Adornee = Object
SelectionBox.Color = BrickColor.new("Toothpaste")
SelectionBox.Parent = Object
return SelectionBox
end
local function Light(Object)
local Light = PointLight:Clone()
Light.Range = (Light.Range + 2)
Light.Parent = Object
end
function FadeOutObjects(Objects, FadeIncrement)
repeat
local LastObject = nil
for i, v in pairs(Objects) do
v.Transparency = (v.Transparency + FadeIncrement)
LastObject = v
end
wait()
until LastObject.Transparency >= 1 or not LastObject
end
function Dematerialize(character, humanoid, FirstPart)
if not character or not humanoid then
return
end
humanoid.WalkSpeed = 0
local Parts = {}
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = true
table.insert(Parts, v)
elseif v:IsA("LocalScript") or v:IsA("Script") then
v:Destroy()
end
end
local SelectionBoxes = {}
local FirstSelectionBox = SelectionBoxify(FirstPart)
Light(FirstPart)
wait(0.05)
for i, v in pairs(Parts) do
if v ~= FirstPart then
table.insert(SelectionBoxes, SelectionBoxify(v))
Light(v)
end
end
local ObjectsWithTransparency = GetTransparentsRecursive(character)
FadeOutObjects(ObjectsWithTransparency, 0.1)
wait(0.5)
character:BreakJoints()
humanoid.Health = 0
Debris:AddItem(character, 2)
local FadeIncrement = 0.05
Delay(0.2, function()
FadeOutObjects({FirstSelectionBox}, FadeIncrement)
if character and character.Parent then
character:Destroy()
end
end)
FadeOutObjects(SelectionBoxes, FadeIncrement)
end
function Touched(Projectile, Hit)
if not Hit or not Hit.Parent then
return
end
local character, humanoid = FindCharacterAncestor(Hit)
if character and humanoid and character ~= Character then
local ForceFieldExists = false
for i, v in pairs(character:GetChildren()) do
if v:IsA("ForceField") then
ForceFieldExists = true
end
end
if not ForceFieldExists then
if Projectile then
local HitFadeSound = Projectile:FindFirstChild(Sounds.HitFade.Name)
local torso = humanoid.Torso
if HitFadeSound and torso then
HitFadeSound.Parent = torso
HitFadeSound:Play()
end
end
Dematerialize(character, humanoid, Hit)
end
if Projectile and Projectile.Parent then
Projectile:Destroy()
end
end
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not Player or not Humanoid or Humanoid.Health == 0 then
return
end
end
function Activated(target)
if Tool.Enabled and Humanoid.Health > 0 then
Tool.Enabled = false
InvokeClient("PlaySound", Sounds.Fire)
local HandleCFrame = Handle.CFrame
local FiringPoint = HandleCFrame.p + HandleCFrame:vectorToWorldSpace(NozzleOffset)
local ShotCFrame = CFrame.new(FiringPoint, target)
local LaserShotClone = BaseShot:Clone()
LaserShotClone.CFrame = ShotCFrame + (ShotCFrame.lookVector * (BaseShot.Size.Z / 2))
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.velocity = ShotCFrame.lookVector * Speed
BodyVelocity.Parent = LaserShotClone
LaserShotClone.Touched:connect(function(Hit)
if not Hit or not Hit.Parent then
return
end
Touched(LaserShotClone, Hit)
end)
Debris:AddItem(LaserShotClone, Duration)
LaserShotClone.Parent = game:GetService("Workspace")
wait(0.6) -- FireSound length
InvokeClient("PlaySound", Sounds.Reload)
wait(0.75) -- ReloadSound length
Tool.Enabled = true
end
end
function Unequipped()
end
BaseShot = Instance.new("Part")
BaseShot.Name = "Effect"
BaseShot.BrickColor = BrickColor.new("Toothpaste")
BaseShot.Material = Enum.Material.Plastic
BaseShot.Shape = Enum.PartType.Block
BaseShot.TopSurface = Enum.SurfaceType.Smooth
BaseShot.BottomSurface = Enum.SurfaceType.Smooth
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(0.2, 0.2, 3)
BaseShot.CanCollide = false
BaseShot.Locked = true
SelectionBoxify(BaseShot)
Light(BaseShot)
BaseShotSound = Sounds.HitFade:Clone()
BaseShotSound.Parent = BaseShot
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--// Loccalllsssss
|
local _G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, time, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay, spawn, task, tick, assert =
_G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, time, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, require, table, type, task.wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, task.delay, task.defer, task, tick, function(cond, errMsg) return cond or error(errMsg or "assertion failed!", 2) end;
local ServicesWeUse = {
"Workspace";
"Players";
"Lighting";
"ReplicatedStorage";
"ReplicatedFirst";
"ScriptContext";
"JointsService";
"LogService";
"Teams";
"SoundService";
"StarterGui";
"StarterPack";
"StarterPlayers";
"TestService";
"NetworkClient";
};
|
------------------------------------------------------------------------
--
-- * used only in (lparser) luaY:subexpr()
------------------------------------------------------------------------
|
function luaK:infix(fs, op, v)
if op == "OPR_AND" then
self:goiftrue(fs, v)
elseif op == "OPR_OR" then
self:goiffalse(fs, v)
elseif op == "OPR_CONCAT" then
self:exp2nextreg(fs, v) -- operand must be on the 'stack'
elseif op == "OPR_ADD" or op == "OPR_SUB" or
op == "OPR_MUL" or op == "OPR_DIV" or
op == "OPR_MOD" or op == "OPR_POW" then
if not self:isnumeral(v) then self:exp2RK(fs, v) end
else
self:exp2RK(fs, v)
end
end
|
--[[Susupension]]
|
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 500 -- Spring Dampening
Tune.FSusStiffness = 7000 -- Spring Force
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FSusMaxExt = .3 -- Max Extension Travel (in studs)
Tune.FSusMaxComp = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 500 -- Spring Dampening
Tune.RSusStiffness = 7000 -- Spring Force
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RSusMaxExt = .3 -- Max Extension Travel (in studs)
Tune.RSusMaxComp = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Really black" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
--script.Parent.Parent.Mover2.part.Anchored = true
|
script.Parent.Parent.Mover2.part.PrismaticConstraint.Speed = 0
script.Parent.Parent.Mover2.part.PrismaticConstraint.TargetPosition = script.Parent.Parent.Mover1.part.PrismaticConstraint.CurrentPosition
wait(1)
script.Parent.Parent.Grabber.Claw.Drop.Disabled = false
script.Disabled = true
|
--[[
Creates a new element representing the given component.
Elements are lightweight representations of what a component instance should
look like.
Children is a shorthand for specifying `Roact.Children` as a key inside
props. If specified, the passed `props` table is mutated!
]]
|
local function createElement(component, props, children)
if config.typeChecks then
assert(component ~= nil, "`component` is required")
assert(typeof(props) == "table" or props == nil, "`props` must be a table or nil")
assert(typeof(children) == "table" or children == nil, "`children` must be a table or nil")
end
if props == nil then
props = {}
end
if children ~= nil then
if props[Children] ~= nil then
Logging.warnOnce(multipleChildrenMessage)
end
props[Children] = children
end
local elementKind = ElementKind.fromComponent(component)
local element = {
[Type] = Type.Element,
[ElementKind] = elementKind,
component = component,
props = props,
}
if config.elementTracing then
-- We trim out the leading newline since there's no way to specify the
-- trace level without also specifying a message.
element.source = debug.traceback("", 2):sub(2)
end
return element
end
return createElement
|
--[[Controls]]
|
local _CTRL = _Tune.Controls
local Controls = Instance.new("Folder",script.Parent)
Controls.Name = "Controls"
for i,v in pairs(_CTRL) do
local a=Instance.new("StringValue",Controls)
a.Name=i
a.Value=v.Name
a.Changed:connect(function()
if i=="MouseThrottle" or i=="MouseBrake" then
if a.Value == "MouseButton1" or a.Value == "MouseButton2" then
_CTRL[i]=Enum.UserInputType[a.Value]
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
end)
end
--Deadzone Adjust
local _PPH = _Tune.Peripherals
for i,v in pairs(_PPH) do
local a = Instance.new("IntValue",Controls)
a.Name = i
a.Value = v
a.Changed:connect(function()
a.Value=math.min(100,math.max(0,a.Value))
_PPH[i] = a.Value
end)
end
--Input Handler
function DealWithInput(input,IsRobloxFunction)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus
--Shift Down [Manual Transmission]
if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and ((_TMode=="Auto" and _CGear<=1) or _TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 then _ClutchOn = true end
if (_CGear ~= 0 and (_CGear ~= ((#_Tune.Ratios-3)-(#_Tune.Ratios-2)))) and _TMode=="Semi" then
_GThrotShift = 0
wait(_Tune.ShiftTime/2)
_GThrotShift = 1
end
_CGear = math.max(_CGear-1,-1)
_ClutchOn = true
wait(0.3)
if not _TMode=="Manual" then _ClutchOn = true end
--Shift Up [Manual Transmission]
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and ((_TMode=="Auto" and _CGear<1) or _TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 then _ClutchOn = true end
if ((_CGear ~= 0) and (_CGear ~= #_Tune.Ratios-2)) and _TMode=="Semi" then
_GThrotShift = 0
wait(_Tune.ShiftTime)
_GThrotShift = 1
end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
_ClutchOn = true
wait(0.3)
if not _TMode=="Manual" then _ClutchOn = true end
--Toggle Clutch
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClutchOn = false
_ClPressing = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClutchOn = true
_ClPressing = false
wait(0.45)
end
--Toggle PBrake
elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then _PBrake = false end
end
--Toggle Transmission Mode
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
--Throttle
elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle/100
end
--Brake
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GBrake = 1
else
_GBrake = 0
end
--Steer Left
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
--Steer Right
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
--Toggle Mouse Controls
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_GThrot = _Tune.IdleThrottle/100
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
--Toggle TCS
elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then _TCS = not _TCS end
--Toggle ABS
elseif _Tune.ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
if input.UserInputState == Enum.UserInputState.End then _ABS = not _ABS end
end
--Variable Controls
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Steering
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
--Gamepad Throttle
elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_GBrake = 0
if _CGear~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
-- connect events
|
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
Humanoid.PlatformStanding:connect(onPlatformStanding)
|
-- called to check for dead connections and run their cleanup tasks
|
local function runCleanupTasks()
if numTasks == 0 then
return
end
-- we want to clean as much stuff up as possible, but we don't want to hang
-- the client, so we forcibly terminate after a short while
local startTime = os.clock()
local endTime = startTime + 1/1000
-- run at most `numTask` times
for _=1, numTasks do
local taskData = tasks[currentIndex]
if taskData.connection.Connected then
-- instance is still alive, so move on to the next task
currentIndex += 1
else
-- instance destroyed, so run cleanup and remove the task
taskData.cleaned = true
-- print("cleaning up", taskData.debugName)
cleanup(taskData.task)
table.remove(tasks, currentIndex)
numTasks -= 1
end
-- wrap around if we passed the end of the task list
if currentIndex > numTasks then
currentIndex = 1
end
-- if this took too long, exit early to avoid hanging
if os.clock() > endTime then
break
end
end
end
RunService.Heartbeat:Connect(runCleanupTasks)
local function cleanupOnDestroy(instance: Instance?, task: cleanup.Task): (() -> ())
-- set up connection so we can check if the instance is alive
-- we don't care about the event we're connecting to, just that we can see
-- when it's disconnected by the garbage collector
local connection = (instance :: Instance):GetPropertyChangedSignal("ClassName"):Connect(noOp)
-- store data about the task for later
local taskData = {
connection = connection,
task = task,
cleaned = false
}
-- remove instance reference so we don't accidentally inhibit gc
instance = nil
-- add task to list
numTasks += 1
tasks[numTasks] = taskData
-- return disconnect function to stop listening for destroy
return function()
if taskData.cleaned then
return
end
taskData.cleaned = true
connection:Disconnect()
local index = table.find(tasks, taskData)
if index ~= nil then
table.remove(tasks, index)
numTasks -= 1
end
end
end
return cleanupOnDestroy
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 10
local slash_damage = 20
local lunge_damage = 40
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7
local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
game.Debris:AddItem(creator_tag, 1)
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function lunge()
damage = lunge_damage
LungeSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool
local force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,80,0)
force.Parent = Tool.Parent.Torso
wait(.25)
force.velocity = (Tool.Parent.Torso.CFrame.lookVector * 120) + Vector3.new(0, 60,0)
swordOut()
wait(.5)
force.Parent = nil
wait(.5)
swordUp()
damage = slash_damage
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
function swordAcross()
-- parry
end
Tool.Enabled = true
local last_attack = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
t = r.Stepped:wait()
if (t - last_attack < .2) then
lunge()
else
attack()
end
last_attack = t
--wait(.5)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
function reveal()
-- tag all nearby invisible players for reveal
-- only check when the weapon is equipped
if (script:IsDescendantOf(game.Workspace) == false) then return end
local p = game.Players:GetPlayers()
for i=1,#p do
local c = p[i].Character
if (c ~= nil) then
if (script.Parent.Parent ~= nil and script.Parent.Parent ~= c) then -- don't check self
local torso = c:FindFirstChild("Torso")
if (torso ~= nil) then
if (torso.Position - script.Parent.Handle.Position).magnitude < 32 then
local parts = c:GetChildren()
for j=1,#parts do
if (parts[j].className == "Part") then
if (parts[j]:FindFirstChild("IlluminaSparkles") == nil) then
if (parts[j].Transparency > 0) then
local s = script.Parent.Handle.IlluminaSparkles:Clone()
game.Debris:AddItem(s, 2)
s.Parent = parts[j]
end
end
end
end
end
end
end
end
end
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
while true do
wait(.25)
reveal()
end
|
--[=[
Round the given number to given precision
```lua
print(Math.round(72.1, 5)) --> 75
```
@param number number
@param precision number? -- Defaults to 1
@return number
]=]
|
function Math.round(number: number, precision: number?): number
if precision then
return math.floor((number/precision) + 0.5) * precision
else
return math.floor(number + 0.5)
end
end
|
--[=[
@tag Component Class
`Start` is called when the component is started. At this point in time, it
is safe to grab other components also bound to the same instance.
```lua
local MyComponent = Component.new({Tag = "MyComponent"})
local AnotherComponent = require(somewhere.AnotherComponent)
function MyComponent:Start()
-- e.g., grab another component:
local another = self:GetComponent(AnotherComponent)
end
```
]=]
|
function Component:Start() end
|
-- declarations
|
local sFallingDown = newSound("rbxasset://sounds/splat.wav")
local sGettingUp = newSound("rbxasset://sounds/action_get_up.mp3")
local sDied = newSound("rbxasset://sounds/uuhhh.mp3")
local sFreeFalling = newSound("rbxasset://sounds/action_falling.mp3")
local sJumping = newSound("rbxasset://sounds/action_jump.mp3")
local sLanding = newSound("rbxasset://sounds/action_jump_land.mp3")
local sSplash = newSound("rbxasset://sounds/impact_water.mp3")
local sRunning = newSound("rbxasset://sounds/action_footsteps_plastic.mp3")
sRunning.Looped = true
local sSwimming = newSound("rbxasset://sounds/action_swim.mp3")
sSwimming.Looped = true
local sClimbing = newSound("rbxasset://sounds/action_footsteps_plastic.mp3")
sClimbing.Looped = true
local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")
local prevState = "None"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.