prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--- Impulse the spring with a change in velocity
-- @param velocity The velocity to impulse with |
function Spring:Impulse(velocity)
self.Velocity = self.Velocity + velocity
end
|
-- Decompiled with the Synapse X Luau decompiler. |
local l__Players__1 = game:GetService("Players");
local v2 = require(script.Parent:WaitForChild("BaseCharacterController"));
local v3 = setmetatable({}, v2);
v3.__index = v3;
function v3.new()
local v4 = setmetatable(v2.new(), v3);
v4.isFollowStick = false;
v4.thumbstickFrame = nil;
v4.moveTouchObject = nil;
v4.onTouchMovedConn = nil;
v4.onTouchEndedConn = nil;
v4.screenPos = nil;
v4.stickImage = nil;
v4.thumbstickSize = nil;
return v4;
end;
local u1 = Vector3.new(0, 0, 0);
function v3.Enable(p1, p2, p3)
if p2 == nil then
return false;
end;
if p2 then
local v5 = true;
else
v5 = false;
end;
p2 = v5;
if p1.enabled == p2 then
return true;
end;
p1.moveVector = u1;
p1.isJumping = false;
if p2 then
if not p1.thumbstickFrame then
p1:Create(p3);
end;
p1.thumbstickFrame.Visible = true;
else
p1.thumbstickFrame.Visible = false;
p1:OnInputEnded();
end;
p1.enabled = p2;
end;
function v3.OnInputEnded(p4)
p4.thumbstickFrame.Position = p4.screenPos;
p4.stickImage.Position = UDim2.new(0, p4.thumbstickFrame.Size.X.Offset / 2 - p4.thumbstickSize / 4, 0, p4.thumbstickFrame.Size.Y.Offset / 2 - p4.thumbstickSize / 4);
p4.moveVector = u1;
p4.isJumping = false;
p4.thumbstickFrame.Position = p4.screenPos;
p4.moveTouchObject = nil;
end;
local l__UserInputService__2 = game:GetService("UserInputService");
local l__GuiService__3 = game:GetService("GuiService");
function v3.Create(p5, p6)
if p5.thumbstickFrame then
p5.thumbstickFrame:Destroy();
p5.thumbstickFrame = nil;
if p5.onTouchMovedConn then
p5.onTouchMovedConn:Disconnect();
p5.onTouchMovedConn = nil;
end;
if p5.onTouchEndedConn then
p5.onTouchEndedConn:Disconnect();
p5.onTouchEndedConn = nil;
end;
end;
local v6 = math.min(p6.AbsoluteSize.x, p6.AbsoluteSize.y) <= 500;
if v6 then
local v7 = 70;
else
v7 = 120;
end;
p5.thumbstickSize = v7;
p5.screenPos = v6 and UDim2.new(0, p5.thumbstickSize / 2 - 10, 1, -p5.thumbstickSize - 20) or UDim2.new(0, p5.thumbstickSize / 2, 1, -p5.thumbstickSize * 1.75);
p5.thumbstickFrame = Instance.new("Frame");
p5.thumbstickFrame.Name = "ThumbstickFrame";
p5.thumbstickFrame.Active = true;
p5.thumbstickFrame.Visible = false;
p5.thumbstickFrame.Size = UDim2.new(0, p5.thumbstickSize, 0, p5.thumbstickSize);
p5.thumbstickFrame.Position = p5.screenPos;
p5.thumbstickFrame.BackgroundTransparency = 1;
local v8 = Instance.new("ImageLabel");
v8.Name = "OuterImage";
v8.Image = "rbxasset://textures/ui/TouchControlsSheet.png";
v8.ImageRectOffset = Vector2.new();
v8.ImageRectSize = Vector2.new(220, 220);
v8.BackgroundTransparency = 1;
v8.Size = UDim2.new(0, p5.thumbstickSize, 0, p5.thumbstickSize);
v8.Position = UDim2.new(0, 0, 0, 0);
v8.Parent = p5.thumbstickFrame;
p5.stickImage = Instance.new("ImageLabel");
p5.stickImage.Name = "StickImage";
p5.stickImage.Image = "rbxasset://textures/ui/TouchControlsSheet.png";
p5.stickImage.ImageRectOffset = Vector2.new(220, 0);
p5.stickImage.ImageRectSize = Vector2.new(111, 111);
p5.stickImage.BackgroundTransparency = 1;
p5.stickImage.Size = UDim2.new(0, p5.thumbstickSize / 2, 0, p5.thumbstickSize / 2);
p5.stickImage.Position = UDim2.new(0, p5.thumbstickSize / 2 - p5.thumbstickSize / 4, 0, p5.thumbstickSize / 2 - p5.thumbstickSize / 4);
p5.stickImage.ZIndex = 2;
p5.stickImage.Parent = p5.thumbstickFrame;
local u4 = nil;
p5.thumbstickFrame.InputBegan:Connect(function(p7)
if not (not p5.moveTouchObject) or p7.UserInputType ~= Enum.UserInputType.Touch or p7.UserInputState ~= Enum.UserInputState.Begin then
return;
end;
p5.moveTouchObject = p7;
p5.thumbstickFrame.Position = UDim2.new(0, p7.Position.x - p5.thumbstickFrame.Size.X.Offset / 2, 0, p7.Position.y - p5.thumbstickFrame.Size.Y.Offset / 2);
u4 = Vector2.new(p5.thumbstickFrame.AbsolutePosition.x + p5.thumbstickFrame.AbsoluteSize.x / 2, p5.thumbstickFrame.AbsolutePosition.y + p5.thumbstickFrame.AbsoluteSize.y / 2);
local v9 = Vector2.new(p7.Position.x - u4.x, p7.Position.y - u4.y);
end);
local function u5(p8)
local v10 = p8 / (p5.thumbstickSize / 2);
local l__magnitude__11 = v10.magnitude;
if l__magnitude__11 < 0.05 then
local v12 = Vector3.new();
else
local v13 = v10.unit * ((l__magnitude__11 - 0.05) / 0.95);
v12 = Vector3.new(v13.x, 0, v13.y);
end;
p5.moveVector = v12;
end;
local function u6(p9)
local v14 = Vector2.new(p9.x - u4.x, p9.y - u4.y);
local l__magnitude__15 = v14.magnitude;
local v16 = p5.thumbstickFrame.AbsoluteSize.x / 2;
if p5.isFollowStick and v16 < l__magnitude__15 then
local v17 = v14.unit * v16;
p5.thumbstickFrame.Position = UDim2.new(0, p9.x - p5.thumbstickFrame.AbsoluteSize.x / 2 - v17.x, 0, p9.y - p5.thumbstickFrame.AbsoluteSize.y / 2 - v17.y);
else
v14 = v14.unit * math.min(l__magnitude__15, v16);
end;
p5.stickImage.Position = UDim2.new(0, v14.x + p5.stickImage.AbsoluteSize.x / 2, 0, v14.y + p5.stickImage.AbsoluteSize.y / 2);
end;
p5.onTouchMovedConn = l__UserInputService__2.TouchMoved:Connect(function(p10, p11)
if p10 == p5.moveTouchObject then
u4 = Vector2.new(p5.thumbstickFrame.AbsolutePosition.x + p5.thumbstickFrame.AbsoluteSize.x / 2, p5.thumbstickFrame.AbsolutePosition.y + p5.thumbstickFrame.AbsoluteSize.y / 2);
u5((Vector2.new(p10.Position.x - u4.x, p10.Position.y - u4.y)));
u6(p10.Position);
end;
end);
p5.onTouchEndedConn = l__UserInputService__2.TouchEnded:Connect(function(p12, p13)
if p12 == p5.moveTouchObject then
p5:OnInputEnded();
end;
end);
l__GuiService__3.MenuOpened:Connect(function()
if p5.moveTouchObject then
p5:OnInputEnded();
end;
end);
p5.thumbstickFrame.Parent = p6;
end;
return v3;
|
--Variables |
local SeatInteractionCount = {}
local VehicleSeating = {}
local function getVehicleObject()
return script.Parent.Parent
end
local function carjackingEnabled(obj)
return obj:GetAttribute("AllowCarjacking")
end
local function getEffectsFolderFromSeat(seat)
local parent = seat.Parent
if parent:IsA("Model") then
if parent:FindFirstChild("Effects") then
return parent.Effects
else
return getEffectsFolderFromSeat(parent)
end
end
return nil
end
local function playDoorSound(seat, sound)
local sound = seat:FindFirstChild(sound.."Door")
if sound then
sound:Play()
end
end
|
--//sw |
local sw = Instance.new("Motor", script.Parent.Parent.Misc.SW.SS)
sw.MaxVelocity = 0.167
sw.Part0 = script.Parent.SW
sw.Part1 = sw.Parent
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 20 -- cooldown for use of the tool again
ZoneModelName = "Big star" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
-- Humanoid:UnequipTools()
-- if tool then
-- Humanoid:EquipTool(tool)
-- end |
for i,v in pairs(Char:GetChildren()) do
if v:IsA('Tool') then
v.Parent = Backpack
end
end
if tool then
tool.Parent = Char
tool.Unequipped:connect(function()
wait()
EquippedVal.Value = getSlotFromTool(Char:FindFirstChildOfClass('Tool'))
--EquippedVal.Value = nil
end)
end
if tool == nil then
EquippedVal.Value = nil
end
end
-- Takes Enum.KeyCode and gets string at end
local function getKeyCodeName(keycode)
keycode = tostring(keycode)
local splitStrings = string.split(keycode,'.')
return splitStrings[#splitStrings]
end
-- Equips whatever the Equipped Obj's value is
EquippedVal.Changed:Connect(function()
local equipSlot = EquippedVal.Value
if equipSlot then
equip(equipSlot.Value)
else
equip(nil)
end
end)
-- ensure equipped items replicate when changed
for i,v in pairs(SlotsFolder:GetChildren()) do
v.Changed:connect(function()
if EquippedVal.Value == v then
wait() -- required to prevent slot duping
equip(v.Value)
end
end)
end
-- Checks keyboard input
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed then -- Ensures user is not typing in TextBox
-- Ensures user is using keybooard
if input.UserInputType == Enum.UserInputType.Keyboard then
-- Get the KeyCode and KeyCode's ending/name
local keyPressed = input.KeyCode
keyPressed = getKeyCodeName(keyPressed)
-- Checks if there is a slot w/ the pressed key's name
local slotRequested = SlotsFolder:FindFirstChild(keyPressed)
if slotRequested then -- if there is such a slot
-- if they're requesting the same slot
if EquippedVal.Value == slotRequested then
EquippedVal.Value = nil -- unequip the tool
else
EquippedVal.Value = slotRequested -- equip the tool
end
end
end
end
end)
return EquippedVal
end
|
--// No-opt connect Server>Client RemoteEvents to ensure they cannot be called
--// to fill the remote event queue. |
local function emptyFunction()
--intentially empty
end
local function GetObjectWithNameAndType(parentObject, objectName, objectType)
for i, child in pairs(parentObject:GetChildren()) do
if (child:IsA(objectType) and child.Name == objectName) then
return child
end
end
return nil
end
local function CreateIfDoesntExist(parentObject, objectName, objectType)
local obj = GetObjectWithNameAndType(parentObject, objectName, objectType)
if (not obj) then
obj = Instance.new(objectType)
obj.Name = objectName
obj.Parent = parentObject
end
useEvents[objectName] = obj
return obj
end
|
--Suspension Placement-- |
local SFL = FL:Clone()
SFL.Name = "FL"
SFL.CanCollide = false
SFL.Parent = script.Parent.Parent
SFL.CFrame = SFL.CFrame + (Vector3.new(SFL.Size.X,SFL.Size.X,SFL.Size.X) * SFL.CFrame.upVector)
SFL.Attachment.Rotation = Vector3.new(0,0,90)
local SFR = FR:Clone()
SFR.Name = "FR"
SFR.CanCollide = false
SFR.Parent = script.Parent.Parent
SFR.CFrame = SFR.CFrame + (Vector3.new(SFL.Size.X,SFL.Size.X,SFL.Size.X) * SFR.CFrame.upVector)
SFR.Attachment.Rotation = Vector3.new(0,0,90)
local SRL = RL:Clone()
SRL.Name = "RL"
SRL.CanCollide = false
SRL.Parent = script.Parent.Parent
SRL.CFrame = SRL.CFrame + (Vector3.new(SFL.Size.X,SFL.Size.X,SFL.Size.X) * SRL.CFrame.upVector)
SRL.Attachment.Rotation = Vector3.new(0,0,90)
local SRR = RR:Clone()
SRR.Name = "RR"
SRR.CanCollide = false
SRR.Parent = script.Parent.Parent
SRR.CFrame = SRR.CFrame + (Vector3.new(SFL.Size.X,SFL.Size.X,SFL.Size.X) * SRR.CFrame.upVector)
SRR.Attachment.Rotation = Vector3.new(0,0,90)
|
-- Implements Javascript's `Array.prototype.reduce` as defined below
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
-- TODO Luau: when Luau supports overloads, use them here so that reduceFn can correctly use T when initialValue (U) isn't supplied |
return function<T, U>(array: Array<T>, callback: reduceFn<T, U>, initialValue: U?): U
if _G.__DEV__ then
if typeof(array) ~= "table" then
error(string.format("Array.reduce called on %s", typeof(array)))
end
if typeof(callback) ~= "function" then
error("callback is not a function")
end
end
local length = #array
local value: T | U
local initial = 1
if initialValue ~= nil then
value = initialValue
else
initial = 2
if length == 0 then
error("reduce of empty array with no initial value")
end
value = array[1]
end
for i = initial, length do
value = callback(value :: U, array[i], i, array)
end
return value :: U
end
|
--[[
-- Original By Kip Turner, Copyright Roblox 2014
-- Updated by Garnold to utilize the new PathfindingService API, 2017
-- 2018 PlayerScripts Update - AllYourBlox
--]] | |
--Made by Stickmasterluke |
sp=script.Parent
damage=0 -- +/- 10%
damagewindow=1 --after clicking, how long does the player have to hit the opponent wioth their weapon to deal damage
swingrate=.65
clashsounds={91154405,91154446,91154471,91154503,91154521}
swooshsounds={89357340,89357340}
hitsounds={91154909,91154932,91154954}
anims={"Stab1","Stab2","LeftSlash"}
ready=false
equipped=false
rate=1/30
lastswing=0
function waitfor(a,b)
while a:FindFirstChild(b)==nil do
a.ChildAdded:wait()
end
return a:FindFirstChild(b)
end
reloading=waitfor(sp,"Reloading")
down=waitfor(sp,"MouseDown")
runanim=waitfor(sp,"RunAnim")
sparkles=waitfor(sp.Handle,"Sparkles")
debris=game:getService("Debris")
weaponhud=waitfor(sp,"WeaponHud")
weaponnametag=waitfor(weaponhud,"WeaponName")
guibar=waitfor(weaponhud,"Bar")
guibarfill=waitfor(guibar,"Fill")
weaponnametag.Text=sp.Name
function runsound(id,volume)
local volume=volume or 1
local sound=Instance.new("Sound")
sound.Looped=false
sound.Pitch=1
sound.SoundId="http://www.roblox.com/asset/?id="..tostring(id)
sound.PlayOnRemove=false
sound.Volume=volume
debris:AddItem(sound,3)
sound.Parent=sp.Handle
wait()
sound:Play()
end
function billboard(pos,text,time,color)
local pos=pos or Vector3.new(0,0,0)
local text=text or "Hello World!"
local time=time or 2
local color=color or Color3.new(1,0,0)
local pos=pos+Vector3.new(0,5,0)
local ep=Instance.new("Part")
ep.Name="Effect"
ep.formFactor="Custom"
ep.Size=Vector3.new(0,0,0)
ep.TopSurface="Smooth"
ep.BottomSurface="Smooth"
ep.CFrame=CFrame.new(pos)
ep.Anchored=true
ep.CanCollide=false
ep.Transparency=1
local bb=Instance.new("BillboardGui")
bb.Size=UDim2.new(3,0,3,0)
bb.Adornee=ep
local tl=Instance.new("TextLabel")
tl.BackgroundTransparency=1
tl.Size=UDim2.new(0,0,0,0)
tl.Text=text
tl.TextColor3=color
tl.TextScaled=true
tl.Font="ArialBold"
tl.Parent=bb
bb.Parent=ep
debris:AddItem(ep,time+.1)
ep.Parent=game.Workspace
delay(0,function()
local frames=time/rate
for frame=1,frames do
wait(rate)
local percent=frame/frames
ep.CFrame=CFrame.new(pos)+Vector3.new(0,5*percent,0)
tl.TextTransparency=percent
end
ep:remove()
end)
end
function makeblood(part)
--[[
if part then
local b=Instance.new("Part")
b.BrickColor=BrickColor.new("Bright red")
b.formFactor="Custom"
b.Transparency=math.random(0,1)*.5
if math.random()<.5 then
b.CanCollide=false
else
b.CanCollide=true
end
b.TopSurface="Smooth"
b.BottomSurface="Smooth"
b.Size=Vector3.new(.2*math.random(1,5),.2*math.random(1,5),.2*math.random(1,5))
b.Velocity=part.Velocity+(Vector3.new((math.random()-.5),(math.random()-.5),(math.random()-.5))*30)
b.RotVelocity=part.RotVelocity+(Vector3.new((math.random()-.5),(math.random()-.5),(math.random()-.5))*20)
b.CFrame=part.CFrame*CFrame.new((math.random()-.5)*3,(math.random()-.5)*3,(math.random()-.5)*3)*CFrame.Angles(math.pi*2*math.random(),math.pi*2*math.random(),math.pi*2*math.random())
debris:AddItem(b,math.random()*4)
b.Parent=game.Workspace
end
--]]
end
sp.Handle.Touched:connect(function(hit)
if ready and equipped and hit and hit.Parent~=nil and hit:IsDescendantOf(sp.Parent)==false and string.lower(string.sub(hit.Name,1,6))~="effect" and (tick()-lastswing)<=damagewindow then
if hit:FindFirstChild("CanBlock") and sp.Handle:FindFirstChild("Blockable") then
ready=false
runsound(clashsounds[math.random(1,#clashsounds)])
sparkles.Enabled=true
delay(.2,function()
sparkles.Enabled=false
end)
billboard(sp.Handle.Position,"Block",2,Color3.new(1,1,0))
end
local mh=sp.Parent:FindFirstChild("Humanoid")
local eh=hit.Parent:FindFirstChild("Humanoid")
local ra=sp.Parent:FindFirstChild("Right Arm")
local plr=game.Players:GetPlayerFromCharacter(sp.Parent)
if mh and eh and eh~=mh and mh.Health>0 and eh.Health>0 and ra and plr~=nil then
if not plr.Neutral then
local eplr=game.Players:GetPlayerFromCharacter(eh.Parent)
if eplr~=nil and eplr.Neutral==false and eplr.TeamColor==plr.TeamColor then
return --No team killing
end
end
ready=false
for i,v in ipairs(eh:GetChildren()) do
if v.Name=="creator" then
v:remove()
end
end
local creator=Instance.new("ObjectValue")
creator.Name="creator"
creator.Value=plr
creator.Parent=eh
debris:AddItem(creator,1)
local localdamage=math.floor(damage*(.9+(math.random()*.2)))
eh:TakeDamage(localdamage)
billboard(hit.Position,"-"..tostring(localdamage))
runsound(hitsounds[math.random(1,#hitsounds)])
local bloodeffects=math.ceil(localdamage/10)
for i=1,math.random(bloodeffects-1,bloodeffects+1) do
--[[if math.random()<.5 then
makeblood(sp.Handle)
else]]
makeblood(hit)
--end
end
end
end
end)
function Activate()
if equipped and (tick()-lastswing)>=swingrate then
ready=true
reloading.Value=true
runsound(swooshsounds[math.random(1,#swooshsounds)],.5)
newanim=anims[math.random(1,#anims)]
while newanim==runanim.Value do
newanim=anims[math.random(1,#anims)]
end
runanim.Value=newanim
lastswing=tick()
updategui()
wait(swingrate)
reloading.Value=false
if down.Value then
Activate()
end
end
end
down.Changed:connect(function()
if down.Value then
Activate()
end
end)
function updategui()
local swingpercent=math.min((tick()-lastswing)/swingrate,1)
if swingpercent<.5 then --fade from red to yellow then to green
guibarfill.BackgroundColor3=Color3.new(1,swingpercent*2,0)
else
guibarfill.BackgroundColor3=Color3.new(1-((swingpercent-.5)/.5),1,0)
end
guibarfill.Size=UDim2.new(swingpercent,0,1,0)
end
sp.Equipped:connect(function(mouse)
lastswing=tick()
updategui()
reloading.Value=true
ready=false
equipped=true
delay(0,function() --HAAB (Hacking around a bug)
local plr=game.Players:GetPlayerFromCharacter(sp.Parent)
if plr~=nil then
local plrgui=plr:FindFirstChild("PlayerGui")
if plrgui~=nil and weaponhud~=nil then
weaponhud.Parent=plrgui
while equipped do
updategui()
wait(rate)
end
end
end
end)
wait(swingrate)
reloading.Value=false
if down.Value then
Activate()
end
end)
sp.Unequipped:connect(function()
ready=false
equipped=false
delay(0,function() --HAAB
weaponhud.Parent=sp
end)
end)
|
----- Script ----- |
Button.Activated:Connect(function()
Events.LolipopEvent:FireServer()
Frame.Visible = false
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 OriginalWalkSpeed = Humanoid.WalkSpeed
OriginalWalkSpeed = OriginalWalkSpeed
Humanoid.WalkSpeed = 0
local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
local spawnPos = Character.Head.Position
spawnPos = spawnPos + (direction * 5)
Tool.Handle.Transparency = 1
local Object = Tool.Handle:Clone()
Object.Parent = workspace
Object.Transparency = 0
Object.Swing.Pitch = math.random(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)
local rand = 11.25
Object.RotVelocity = Vector3.new(math.random(-rand,rand),math.random(-rand,rand),math.random(-rand,rand))
Object:SetNetworkOwner(getPlayer())
local ScriptClone = DamageScript:Clone()
ScriptClone.FriendlyFire.Value = FriendlyFire
ScriptClone.Damage.Value = AttackDamage
ScriptClone.Parent = Object
ScriptClone.Disabled = false
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "creator"
tag.Parent = Object
Humanoid.WalkSpeed = OriginalWalkSpeed
Tool:Destroy()
end
Remote.OnServerEvent:Connect(function(player, mousePosition)
if not AttackAble then return end
AttackAble = false
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
Remote:FireClient(getPlayer(), "PlayAnimation", "Animation")
end
local targetPos = mousePosition.p
local lookAt = (targetPos - Character.Head.Position).unit
Toss(lookAt)
LeftDown = true
end)
function onLeftUp()
LeftDown = false
end
Tool.Equipped:Connect(function()
Character = Tool.Parent
Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)
Tool.Unequipped:Connect(function()
Character = nil
Humanoid = nil
end)
|
--[=[
@within Plasma
@function button
@tag widgets
@param label string -- The label for the checkbox
@return ButtonWidgetHandle
A text button.
Returns a widget handle, which has the field:
- `clicked`, a function you can call to check if the checkbox was clicked this frame

```lua
Plasma.window("Button", function()
if Plasma.button("button text"):clicked() then
print("clicked!")
end
end)
```
]=] |
local Runtime = require(script.Parent.Parent.Runtime)
local Style = require(script.Parent.Parent.Style)
local create = require(script.Parent.Parent.create)
return Runtime.widget(function(text)
local clicked, setClicked = Runtime.useState(false)
local refs = Runtime.useInstance(function(ref)
local style = Style.get()
return create("TextButton", {
[ref] = "button",
BackgroundColor3 = style.bg3,
BorderSizePixel = 0,
Font = Enum.Font.SourceSans,
Size = UDim2.new(0, 100, 0, 40),
TextColor3 = style.textColor,
AutomaticSize = Enum.AutomaticSize.X,
TextSize = 21,
create("UIPadding", {
PaddingLeft = UDim.new(0, 10),
PaddingRight = UDim.new(0, 10),
}),
create("UICorner"),
Activated = function()
setClicked(true)
end,
})
end)
local instance = refs.button
instance.Text = text
local handle = {
clicked = function()
if clicked then
setClicked(false)
return true
end
return false
end,
}
return handle
end)
|
--Services |
local pathfindingService = game:GetService("PathfindingService")
local runService = game:GetService("RunService")
local modules = script.Parent
local core = require(modules.CoreModule)
local status = require(modules.Status)
local troubleshoot = require(modules.Troubleshoot)
local marine = script.Parent.Parent.Parent
local myHuman = marine.Humanoid
local myRoot = marine.HumanoidRootPart
local moveEvent = Instance.new("BindableEvent")
function movement.moveToFinished()
local success = true
local completed = false
core.spawn(function()
wait(1)
if not completed then
success = false
moveEvent:Fire()
end
end)
core.spawn(function()
myHuman.MoveToFinished:Wait()
moveEvent:Fire()
end)
moveEvent.Event:Wait()
completed = true
return success
end
local path = pathfindingService:CreatePath()
function movement.pathToLocation(target)
if not target or not target.Parent then return end
path:ComputeAsync(myRoot.Position, target.Position)
if path.Status == Enum.PathStatus.NoPath then
return
end
local waypoints = path:GetWaypoints()
--Make sure that path is actually valid
if waypoints[1] and core.checkDist(waypoints[1],myRoot) > 10 then
runService.Heartbeat:Wait()
movement.pathToLocation(target)
end
troubleshoot.visualizePath(path)
for _,waypoint in ipairs(waypoints) do
if waypoint.Action == Enum.PathWaypointAction.Jump then
myHuman.Jump = true
end
myHuman:MoveTo(waypoint.Position)
core.spawn(function()
while myHuman.WalkToPoint.Y > myRoot.Position.Y - 1 do
wait(0.1)
myHuman.Jump = true
end
end)
local moveSuccess = movement.moveToFinished()
local dist = core.checkDist(myRoot,target)
local canSee = core.checkSight(target)
if not moveSuccess or not target.Parent or (dist < 30 and canSee) or status:get("currentTarget") ~= target then
break
elseif (core.checkSight(target) and target.Position.Y <= myRoot.Position.Y-5) then
myHuman:MoveTo(myRoot.Position)
break
end
if core.checkDist(target,waypoints[#waypoints]) > 30 then
--movement.pathToLocation(target)
break
end
end
end
function movement.walkRandom()
local randX = math.random(-100,100)
local randZ = math.random(-100,100)
local goal = myRoot.Position + Vector3.new(randX, 0, randZ)
local path = pathfindingService:CreatePath()
path:ComputeAsync(myRoot.Position, goal)
local waypoints = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
for i,waypoint in ipairs(waypoints) do
if waypoint.Action == Enum.PathWaypointAction.Jump then
myHuman.Jump = true
end
myHuman:MoveTo(waypoint.Position)
core.spawn(function()
wait(0.5)
if myHuman.WalkToPoint.Y > myRoot.Position.Y then
myHuman.Jump = true
end
end)
local moveSuccess = myHuman.MoveToFinished:Wait()
if not moveSuccess or status:get("currentTarget") then
break
end
end
else
wait(2)
end
end
|
--[[
This module script contains all the main animations. I put it into this script so it'll be easier to edit.
Both arms are welded to a single brick called "animBase". This makes it easier to edit movement animations because you only have to
edit the cframe of one brick instead of 2 arms.
The idling, walking, and running animations have a Pos and a Rot component. The Pos component is the position of the weld and the Rot component
is the rotation of the weld. They're vector3 values so the script can multiply each value by an alpha and add them together to make the smooth
transitions possible
The table directly below lets you know how each component of the Vector affects the movement of the weld so it's easier to edit
This module also contains the reload animation which I moved here for easier editing. The animation function has a parameter S that contains all
the functions and variables that are necessary to make the animation run
HOW TO EDIT THE RELOAD ANIMATION:
-Make sure each block of the animation is made into a separate function, it needs to be like this so if the reload animation needs to be stopped
midway, the arms don't glitch out
-Each animation piece should only have one wait command at the end of the function
-Multiply every duration value, including the wait time values by the animSpeed. That way if you change the reload time, you won't have to change
each individual time value for all the animation components
--]] |
local Animations = {
Reload = function(S) --This is the main reload animation. The parameter S contains all the variables and functions that are necessary for this animation
--[[
FUNCTION LIST_
S.tweenJoint(Joint, newC0, newC1, Alpha, Duration) --This function tweens a joint to a given C0 and C1. The Alpha parameter is function
that returns a number between 0 and 1 given an argument of a number between 0 and 90. The Duration is how fast the joint tweens. NOTE,
you can put nil as an argument for the newC0 or newC1 parameter and the function won't tween that specific property of the weld. This
is useful if you only want to mess with the C0 or C1 property of a weld.
S.makeMagInvisible() --This function makes the mag invisible so it looks like the mag was removed
S.makeMagVisible() --This function makes the mag visible again at whatever the previous transparency of the mag parts were
S.isMagVisible() --This function returns a true or false value based on whether or not the mag is visible. This can be used to tell if
the animation was stopped midway and where to restart the animation
S.isMagEmpty() --This function returns a true or false value based on whether or not the mag is empty, meaning the ammo is 0. This can be
used to decide if a chambering animation should play after the reload animation
S.setNewMag() --This function sets the newMag variable in the clientMain to true which basically lets the script know that a new mag was
put into the gun. This is used so that if the reload animation is broken after the new mag was put in but before the chambering animation
then the script will simply play the chambering animation instead of putting in another mag
S.isNewMag() --This function returns a true or false value based on whether or not the mag that is currently attached to the gun is a new
mag. In order for it to be a new mag, it needs to have full ammo. Once you fire, the mag becomes an old mag
S.createMag(Key) --This functions clones the Mag and puts it in a table with a Key parameter so you can access the mag in a separate
function and it returns a Model containing the Mag and a table that contains the original mag bricks and the corresponding clone. NOTE,
the mag bricks will be made non can collide
S.getMag(Key) --This function gets a Mag from the mag table given a Key argument and it returns the model that the mag is contained in
and the brick that all the other mag parts are welded to
S.attachGripToHead() --This function detaches the grip from the right arm and attaches it to the Head. This is so you can make reload
animations that require using the right arm to manipulate the gun in any way. The C0 of the grip is changed so the gun stays in the
position that it was in before you detached the grip from the right arm.
S.attachGripToArm() --This function detaches the grip from the Head and attaches it to the Arm. The C0 of the grip is changed so the gun
stays in the position that it was in before you detached the grip from the head
S.Sine(X) --This function is an Alpha function for the tweenJoint function. Given a number between 0 and 90, the function will return the
sine of that number, which is a number between 0 and 1, which is used to tween a Joint with a Sine movement
S.Linear(X) --This function is an Alpha function for the tweenJoint function. Given a number between 0 and 90, the function will return
the number / 90, which is a number between 0 and 1, which is used to a tween a Joint with a Linear movement
VARIABLE LIST_
S.Handle --This variable is the Handle of gun
S.LArm --This variable is the left arm
S.RArm --This variable is the right arm
S.LWeld --This variable is the left arm weld which is attached to the animBase
S.RWeld --This variable is the right arm weld which is attached to the animBase
S.LC0 --This variable is the cframe of the left arm joint with respect to the torso
S.RC0 --This variable is the cframe of the right arm joint with respect to the torso
S.Grip --This variable is the Grip weld which is attached to right arm
S.gunIgnore --This variable is the gun ignore model which contains the fake arms and bullets and other stuff
S.Cam --This variable is the player camera
S.CF --This variable is the shortened form of CFrame.new which you can use instead of CFrame.new
S.CFANG --This variable is the shortened form of CFrame.Angles which you can use instead of CFrame.Angles
S.V3 --This variable is the shortened form of Vector3.new which you can use instead of Vector3.new
S.RAD --This variable is the shortened form of math.rad which you can use instead of math.rad
S.reloadTimeLoaded --This variable is the reload time for when the gun is loaded which you can use to modify how fast the reload
animation runs
S.reloadTimeEmpty --This variable is the reload time for when the gun is empty which you can use to modify how fast the reload
animation runs
--]]
local W1 = nil
local W2 = nil
local animSpeed = S.isMagEmpty() and S.reloadTimeEmpty / 1.3 or S.reloadTimeLoaded / 0.9
return {
function()
if (not S.isNewMag()) then
if S.isMagVisible() then
local Mag1, magTable1 = S.createMag("Mag1")
Mag1.Parent = S.gunIgnore
W1 = Instance.new("Weld")
W1.Part0 = magTable1[1].magClone
W1.Part1 = S.Handle
W1.C0 = magTable1[1].Original.CFrame:toObjectSpace(S.Handle.CFrame)
W1.Parent = magTable1[1].magClone
S.tweenJoint(S.LWeld, nil, S.CF(-0.9, 2, -1.1) * S.CFANG(S.RAD(-15), 0, S.RAD(-25)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.RWeld, nil, S.CF(0.3, 0.2, -0.31) * S.CFANG(S.RAD(-12), 0, S.RAD(25)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.Grip, nil, S.CFANG(0, S.RAD(20), S.RAD(10)), S.Sine, 0.1 * animSpeed)
wait(0.2 * animSpeed)
end
end
end;
function()
if (not S.isNewMag()) then
if S.isMagVisible() then
S.makeMagInvisible()
W1:Destroy()
local Mag1, magTable1 = S.getMag("Mag1")
magTable1[1].magClone.Velocity = S.Handle.Velocity + S.Handle.CFrame:vectorToWorldSpace(S.V3(0, -1, 0)) * 20
S.tweenJoint(S.RWeld, nil, S.CF(0.3, 0.2, -0.5) * S.CFANG(S.RAD(-20), S.RAD(10), S.RAD(25)), S.Sine, 0.25 * animSpeed)
S.tweenJoint(S.Grip, nil, S.CFANG(0, S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
else
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-12), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
end
S.tweenJoint(S.LWeld, nil, S.CF(0, 0.5, 0) * S.CFANG(S.RAD(95), 0, S.RAD(-25)), S.Sine, 0.2 * animSpeed)
wait(0.25 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
local Mag1, magTable1 = S.getMag("Mag1")
if Mag1 then Mag1:Destroy() end
local Mag2, magTable2 = S.createMag("Mag2")
Mag2.Parent = S.gunIgnore
local LArmCF = S.LWeld.Part0.CFrame * S.LWeld.C0 * (S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60))):inverse()
local RArmCF = S.RWeld.Part0.CFrame * S.RWeld.C0 * (S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25))):inverse()
local handleOffsetCF = S.RArm.CFrame:toObjectSpace(S.RArm.CFrame * S.Grip.C0 * (S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10))):inverse())
local originalMagOffsetCF = S.Handle.CFrame:toObjectSpace(magTable2[1].Original.CFrame)
local newMagC0 = LArmCF:toObjectSpace(RArmCF * handleOffsetCF * originalMagOffsetCF)
W2 = Instance.new("Weld")
W2.Part0 = S.LArm
W2.Part1 = magTable2[1].magClone
W2.C0 = newMagC0
W2.Parent = magTable2[1].magClone
S.tweenJoint(S.LWeld, nil, S.CF(0.55, 1, -2.4) * S.CFANG(S.RAD(-20), S.RAD(20), S.RAD(-60)), S.Sine, 0.2 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-12), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.15 * animSpeed)
S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60)), S.Sine, 0.15 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
local Mag1, _ = S.getMag("Mag1")
local Mag2, _ = S.getMag("Mag2")
S.makeMagVisible()
S.setNewMag()
if Mag1 then Mag1:Destroy() end
Mag2:Destroy()
end
end;
function()
if S.isMagEmpty() then
if S.isNewMag() then
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.15 * animSpeed)
S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60)), S.Sine, 0.15 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
end
S.tweenJoint(S.LWeld, nil, S.CF(0, 1.3, -0.55) * S.CFANG(S.RAD(-26), 0, 0), S.Sine, 0.2 * animSpeed)
wait(0.2 * animSpeed)
end
end;
function()
if S.isMagEmpty() then
S.tweenJoint(S.LWeld, nil, S.CF(0.4, 1.6, -0.55) * S.CFANG(S.RAD(-23), 0, S.RAD(-60)), S.Sine, 0.1 * animSpeed)
wait(0.05 * animSpeed)
end
end;
function()
if S.isMagEmpty() then
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(20)), S.Sine, 0.05 * animSpeed)
wait(0.15 * animSpeed)
end
end;
}
end;
Cocking = function(S)
end;
Crawling = function(X, moveDirection, moveSpeed) --This is the animation for when you're crawling
--[[
The moveDirection gives you the angle at which your character is moving with respect to the way you're facing. So if you're
moving to the right and you're facing forward then the moveDirection will give you an angle of -90. If you're moving backward
and you're facing forward then the moveDirection will give you an angle of 180. I use this angle to adjust the crawling animation
so that you're arms move in the direction that you're moving so it looks more realistic rather than the arms constantly moving forward
The moveVelocity gives you how fast you're moving in the X-Z plane. It doesn't take your Y-velocity into account so if you're falling your
moveVelocity will still be how fast you're moving horizontally. You can use this to adjust how fast the crawling animation runs so if you're
moving really slow the animation will play slower
--]]
return {
leftArm = CFrame.Angles( --This is what the cframe of the right arm will be when you're crawling
0,
math.rad(90),
math.rad(-10)
) * CFrame.new(
math.sin(moveDirection) * (math.sin(X * 6) / 4) - 0.2,
math.cos(moveDirection) * (math.sin(X * 6) / 2) - 0.1,
math.max(math.cos(X * 6) / 4, 0) - 0.1
) * CFrame.Angles(
-math.max(math.cos(X * 6) / 4, 0),
0,
0
);
leftLeg = CFrame.new( --This is what the cframe of the left leg will be when you're crawling
math.sin(moveDirection) * (-math.sin(X * 6) / 4) - 0.2,
math.cos(moveDirection) * (math.sin(X * 6) / 2) + 0.3,
math.max(math.cos(X * 6) / 4, 0) - 0.1
):inverse() * CFrame.Angles(
0,
0,
-math.rad(15) - math.cos(moveDirection) * (math.rad(15) * math.sin(X * 6))
);
rightArm = CFrame.Angles( --This is what the cframe of the left arm will be when you're crawling
0,
math.rad(-5),
math.rad(10)
) * CFrame.new(
math.sin(moveDirection) * (-math.sin(X * 6) / 4) + 0.2,
math.cos(moveDirection) * (-math.sin(X * 6) / 5) - 0.2,
math.max(math.cos((X + math.rad(30)) * 6) / 10, 0) - 0.1
) * CFrame.Angles(
-math.max(math.cos((X + math.rad(30)) * 6) / 10, 0),
0,
0
);
rightLeg = CFrame.new( --This is what the cframe of the right leg will be when you're crawling
math.sin(moveDirection) * (math.sin(X * 6) / 4) + 0.2,
math.cos(moveDirection) * (-math.sin(X * 6) / 2) + 0.3,
math.max(math.cos((X + math.rad(30)) * 6) / 4, 0) - 0.1
):inverse() * CFrame.Angles(
0,
0,
math.rad(15) - math.cos(moveDirection) * (math.rad(15) * math.sin(X * 6))
);
Grip = CFrame.Angles( --This is what the cframe of the grip will be when you're crawling
math.max(math.cos((X + math.rad(30)) * 6) / 7, 0),
math.rad(5),
0
);
Camera = 1.5 * math.rad(math.cos((X + math.rad(30)) * 6)) + math.rad(0.5); --This is what the roll of the camera will be when you're crawling
}
end;
Idling = { --This table holds the Idling animations
unAimed = function(X) --This is the animation when the gun is not aimed
return {
Pos = Vector3.new(
math.sin(X / 2) / 70, --Side to Side motion
math.sin(X * 5 / 4) / 70, --Up and Down motion
math.sin(X * 3 / 4) / 70 --Forward and backward motion
);
Rot = Vector3.new(
0, --Pitch rotation
0, --Yaw rotation
0 --Roll rotation
);
}
end;
Aimed = function(X) --This is the animation when the gun is aimed
return {
Pos = Vector3.new(
math.sin(X * 3 / 8) / 140,
math.sin(X * 15 / 16) / 140,
0
);
Rot = Vector3.new(
0,
0,
0
);
}
end;
};
Walking = { --This table holds the Walking animations
unAimed = function(X) --This is the animation when the gun is not aimed
return {
Pos = Vector3.new(
4 * math.sin(X * 4.5) / 50,
1.5 * math.sin(X * 9) / 50,
0
);
Rot = Vector3.new(
0,
0,
math.rad(math.sin(X * 4.5)) * 2
);
}
end;
Aimed = function(X) --This is the animation when the gun is aimed
return {
Pos = Vector3.new(
2 * math.sin(X * 3) / 150,
0.75 * math.sin(X * 6) / 150,
0
);
Rot = Vector3.new(
0,
0,
math.rad(math.sin(X * 3)) / 3
);
}
end;
};
Running = function(X) --This is the animation when the player is running
return {
Pos = Vector3.new(
4 * math.sin(X * 4.5 * 1.5) / 30,
1.5 * math.sin(X * 9 * 1.5) / 40 + 0.2,
0
);
Rot = Vector3.new(
0,
-math.rad(math.sin(X * 4.5 * 1.5)) * 5 + math.rad(3),
math.rad(math.sin(X * 4.5 * 1.5)) * 5
);
}
end;
}
return Animations
|
---------------------------------------Function start here. |
if (Tool.Enabled == false) then
return false
end--end for if! |
--//BRAKES//-- |
local FLDisk = Instance.new("Part")
FLDisk.Anchored = true
FLDisk.Name = "FLDisk"
FLDisk.TopSurface = Enum.SurfaceType.SmoothNoOutlines
FLDisk.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
FLDisk.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
FLDisk.BackSurface = Enum.SurfaceType.SmoothNoOutlines
FLDisk.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
FLDisk.RightSurface = Enum.SurfaceType.SmoothNoOutlines
FLDisk.Size = Vector3.new(0.4, ((FL.Size.Y)-0.7), ((FL.Size.Y)-0.7))
FLDisk.Parent = FL.Parent
FLDisk.Shape = "Cylinder"
FLDisk.CFrame = FL.CFrame + Vector3.new((FL.Size.Y/2),(FL.Size.Y/2),(FL.Size.Y/2))*rv
FLDisk.CFrame = FLDisk.CFrame * CFrame.Angles(math.rad(75), math.rad(0), math.rad(0))
FLDisk.Transparency = bv
local FRDisk = Instance.new("Part")
FRDisk.Anchored = true
FRDisk.Name = "FRDisk"
FRDisk.TopSurface = Enum.SurfaceType.SmoothNoOutlines
FRDisk.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
FRDisk.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
FRDisk.BackSurface = Enum.SurfaceType.SmoothNoOutlines
FRDisk.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
FRDisk.RightSurface = Enum.SurfaceType.SmoothNoOutlines
FRDisk.Size = Vector3.new(0.4, ((FR.Size.Y)-0.7), ((FR.Size.Y)-0.7))
FRDisk.Parent = FR.Parent
FRDisk.Shape = "Cylinder"
FRDisk.CFrame = FR.CFrame - Vector3.new((FR.Size.Y/2),(FR.Size.Y/2),(FR.Size.Y/2))*rv
FRDisk.CFrame = FRDisk.CFrame * CFrame.Angles(math.rad(75), math.rad(0), math.rad(0))
FRDisk.Transparency = bv
local RLDisk = Instance.new("Part")
RLDisk.Anchored = true
RLDisk.Name = "RLDisk"
RLDisk.TopSurface = Enum.SurfaceType.SmoothNoOutlines
RLDisk.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
RLDisk.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
RLDisk.BackSurface = Enum.SurfaceType.SmoothNoOutlines
RLDisk.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
RLDisk.RightSurface = Enum.SurfaceType.SmoothNoOutlines
RLDisk.Size = Vector3.new(0.4, ((RL.Size.Y)-0.7), ((RL.Size.Y)-0.7))
RLDisk.Parent = RL.Parent
RLDisk.Shape = "Cylinder"
RLDisk.CFrame = RL.CFrame + Vector3.new((RL.Size.Y/2),(RL.Size.Y/2),(RL.Size.Y/2))*rv
RLDisk.CFrame = RLDisk.CFrame * CFrame.Angles(math.rad(75), math.rad(0), math.rad(0))
RLDisk.Transparency = bv
local RRDisk = Instance.new("Part")
RRDisk.Anchored = true
RRDisk.Name = "RRDisk"
RRDisk.TopSurface = Enum.SurfaceType.SmoothNoOutlines
RRDisk.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
RRDisk.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
RRDisk.BackSurface = Enum.SurfaceType.SmoothNoOutlines
RRDisk.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
RRDisk.RightSurface = Enum.SurfaceType.SmoothNoOutlines
RRDisk.Size = Vector3.new(0.4, ((RR.Size.Y)-0.7), ((RR.Size.Y)-0.7))
RRDisk.Parent = RR.Parent
RRDisk.Shape = "Cylinder"
RRDisk.CFrame = RR.CFrame - Vector3.new((RR.Size.Y/2),(RR.Size.Y/2),(RR.Size.Y/2))*rv
RRDisk.CFrame = RRDisk.CFrame * CFrame.Angles(math.rad(75), math.rad(0), math.rad(0))
RRDisk.Transparency = bv
moveF = ((FRDisk.Size.Y/2)+0.08)
move = ((RRDisk.Size.Y/2)+0.08)
VRL = FLDisk.CFrame.lookVector
local FLPad = Instance.new("Part")
FLPad.Anchored = true
FLPad.Size = Vector3.new(.35,0.4,.2)
FLPad.Name = "Pad"
FLPad.CFrame = FLDisk.CFrame + Vector3.new(moveF, moveF, moveF)*VRL*.98
FLPad.Parent = LWm
FLPad.Transparency = bv
local UFLPad = Instance.new("Part")
UFLPad.Anchored = true
UFLPad.Size = Vector3.new(.35,0.4,.2)
UFLPad.Name = "UPad"
UFLPad.CFrame = FLDisk.CFrame + Vector3.new(moveF, moveF, moveF)*(VRL*-1)
UFLPad.Parent = LWm
UFLPad.Transparency = bv
local FRPad = Instance.new("Part")
FRPad.Anchored = true
FRPad.Size = Vector3.new(.35,0.4,.2)
FRPad.Name = "Pad"
FRPad.CFrame = FRDisk.CFrame + Vector3.new(moveF, moveF, moveF)*VRL*.98
FRPad.Parent = RWm
FRPad.Transparency = bv
local UFRPad = Instance.new("Part")
UFRPad.Anchored = true
UFRPad.Size = Vector3.new(.35,0.4,.2)
UFRPad.Name = "UPad"
UFRPad.CFrame = FRDisk.CFrame + Vector3.new(moveF, moveF, moveF)*(VRL*-1)
UFRPad.Parent = RWm
UFRPad.Transparency = bv
local RLPad = Instance.new("Part")
RLPad.Anchored = true
RLPad.Size = Vector3.new(.35,0.4,.2)
RLPad.Name = "Pad"
RLPad.Parent = suspRL
RLPad.CFrame = RLDisk.CFrame + Vector3.new(move, move, move)*VRL*.98
RLPad.Transparency = bv
local URLPad = Instance.new("Part")
URLPad.Anchored = true
URLPad.Size = Vector3.new(.35,0.4,.2)
URLPad.Name = "UPad"
URLPad.CFrame = RLDisk.CFrame + Vector3.new(move, move, move)*(VRL*-1)
URLPad.Parent = suspRL
URLPad.Transparency = bv
local RRPad = Instance.new("Part")
RRPad.Anchored = true
RRPad.Size = Vector3.new(.35,0.4,.2)
RRPad.Name = "Pad"
RRPad.Parent = suspRR
RRPad.CFrame = RRDisk.CFrame + Vector3.new(move, move, move)*VRL*.98
RRPad.Transparency = bv
local URRPad = Instance.new("Part")
URRPad.Anchored = true
URRPad.Size = Vector3.new(.35,0.4,.2)
URRPad.Name = "UPad"
URRPad.CFrame = RRDisk.CFrame + Vector3.new(move, move, move)*(VRL*-1)
URRPad.Parent = suspRR
URRPad.Transparency = bv
local hitboxF = Instance.new("Part")
local x = Vector3.new(FLDisk.Position.X - FRDisk.Position.X)
local z = Vector3.new(FLDisk.Position.Z - FRDisk.Position.Z)
local t = x + z
local tt = math.abs(t.X)
hitboxF.Size = Vector3.new(1, 2, tt+2)
hitboxF.Anchored = true
hitboxF.Parent = script.Parent.Parent
hitboxF.Rotation = FLDisk.Rotation
hitboxF.CFrame = CFrame.new(((FLDisk.Position + FRDisk.Position))/2)
hitboxF.CFrame = hitboxF.CFrame + Vector3.new(FL.Size.Y/1.15, FL.Size.Y/1.15, FL.Size.Y/1.15)*(lv*1)
hitboxF.CFrame = hitboxF.CFrame + Vector3.new(0.5, 0.5, 0.5)*(uv*1)
hitboxF.Transparency = 1
hitboxF.Name = "HitboxF"
local hitboxR = Instance.new("Part")
local x = Vector3.new(RLDisk.Position.X - RRDisk.Position.X)
local z = Vector3.new(RLDisk.Position.Z - RRDisk.Position.Z)
local t = x + z
local tt = math.abs(t.X)
hitboxR.Size = Vector3.new(1, 2, tt+2)
hitboxR.Anchored = true
hitboxR.Parent = script.Parent.Parent
hitboxR.Rotation = RLDisk.Rotation
hitboxR.CFrame = CFrame.new(((RLDisk.Position + RRDisk.Position))/2)
hitboxR.CFrame = hitboxR.CFrame + Vector3.new(RL.Size.Y/1.15, RL.Size.Y/1.15, RL.Size.Y/1.15)*(lv*-1)
hitboxR.CFrame = hitboxR.CFrame + Vector3.new(0.5, 0.5, 0.5)*(uv*1)
hitboxR.Transparency = 1
hitboxR.Name = "HitboxR"
|
--[[
Returns a new promise that:
* is resolved when all input promises resolve
* is rejected if ANY input promises reject
]] |
function Promise._all(traceback, promises, amount)
if type(promises) ~= "table" then
error(string.format(ERROR_NON_LIST, "Promise.all"), 3)
end
-- We need to check that each value is a promise here so that we can produce
-- a proper error rather than a rejected promise with our error.
for i, promise in pairs(promises) do
if not Promise.is(promise) then
error(string.format(ERROR_NON_PROMISE_IN_LIST, "Promise.all", tostring(i)), 3)
end
end
-- If there are no values then return an already resolved promise.
if #promises == 0 or amount == 0 then
return Promise.resolve({})
end
return Promise._new(traceback, function(resolve, reject, onCancel)
-- An array to contain our resolved values from the given promises.
local resolvedValues = {}
local newPromises = {}
-- Keep a count of resolved promises because just checking the resolved
-- values length wouldn't account for promises that resolve with nil.
local resolvedCount = 0
local rejectedCount = 0
local done = false
local function cancel()
for _, promise in ipairs(newPromises) do
promise:cancel()
end
end
-- Called when a single value is resolved and resolves if all are done.
local function resolveOne(i, ...)
if done then
return
end
resolvedCount = resolvedCount + 1
if amount == nil then
resolvedValues[i] = ...
else
resolvedValues[resolvedCount] = ...
end
if resolvedCount >= (amount or #promises) then
done = true
resolve(resolvedValues)
cancel()
end
end
onCancel(cancel)
-- We can assume the values inside `promises` are all promises since we
-- checked above.
for i, promise in ipairs(promises) do
newPromises[i] = promise:andThen(function(...)
resolveOne(i, ...)
end, function(...)
rejectedCount = rejectedCount + 1
if amount == nil or #promises - rejectedCount < amount then
cancel()
done = true
reject(...)
end
end)
end
if done then
cancel()
end
end)
end
|
--Main function |
local function AttachAuraControl(source_part, eff_cont) --(source_part, effect_container)
local AnimObj
local function Start()
AnimObj = {}
AnimObj["LastUpdate"] = tick()
AnimObj["Parts"] = {}
for i = 1, 6 do
local np = EFFECT_LIB.NewInvisiblePart()
np.Transparency = 1
local fire = Instance.new("Fire")
fire.Color = Color3.new(255, 0, 127)
fire.SecondaryColor = Color3.new(255, 85, 127)
fire.Heat = 5
fire.Size = 4
fire.Parent = np
AnimObj["Parts"][i] = np
np.Parent = eff_cont
end
end
local function Update()
local loop = EFFECT_LIB.Loop(4)
local loop2 = EFFECT_LIB.Loop(0.8)
for i = 1, #AnimObj["Parts"] do
AnimObj["Parts"][i].CFrame = source_part.CFrame * CFrame.Angles(1, math.rad(loop * 360 + (360 / #AnimObj["Parts"] * (i - 1))), 0) * CFrame.new(0, 0, -3) * CFrame.Angles(0, math.rad(90), 0) * CFrame.Angles(math.rad(loop2 * -360 + (i * 180)), 0, 0)
end
end
local function Stop()
eff_cont:ClearAllChildren()
AnimObj = nil
end
return {Start = Start, Update = Update, Stop = Stop}
end
return AttachAuraControl
|
-- Remeber to select the animtion object and set the id to your own! |
local walkAnim = script:WaitForChild("Walk")
local walkAnimTrack = humanoid.Animator:LoadAnimation(walkAnim)
local idleAnim = script:WaitForChild("Idle")
local idleAnimTrack = humanoid.Animator:LoadAnimation(idleAnim)
humanoid.Running:Connect(function(speed)
if speed > 0 then
if not walkAnimTrack.IsPlaying and idleAnimTrack.IsPlaying then
idleAnimTrack:Stop()
walkAnimTrack:Play()
end
else
if walkAnimTrack.IsPlaying and not idleAnimTrack.IsPlaying then
idleAnimTrack:Play()
walkAnimTrack:Stop()
end
end
end)
idleAnimTrack:Play()
|
--[[
Used to set a handler for when the promise resolves, rejects, or is
cancelled.
]] |
function Promise.prototype:_finally(traceback, finallyHandler)
self._unhandledRejection = false
local promise = Promise._new(traceback, function(resolve, reject, onCancel)
local handlerPromise
onCancel(function()
-- The finally Promise is not a proper consumer of self. We don't care about the resolved value.
-- All we care about is running at the end. Therefore, if self has no other consumers, it's safe to
-- cancel. We don't need to hold out cancelling just because there's a finally handler.
self:_consumerCancelled(self)
if handlerPromise then
handlerPromise:cancel()
end
end)
local finallyCallback = resolve
if finallyHandler then
finallyCallback = function(...)
local callbackReturn = finallyHandler(...)
if Promise.is(callbackReturn) then
handlerPromise = callbackReturn
callbackReturn
:finally(function(status)
if status ~= Promise.Status.Rejected then
resolve(self)
end
end)
:catch(function(...)
reject(...)
end)
else
resolve(self)
end
end
end
if self._status == Promise.Status.Started then
-- The promise is not settled, so queue this.
table.insert(self._queuedFinally, finallyCallback)
else
-- The promise already settled or was cancelled, run the callback now.
finallyCallback(self._status)
end
end)
return promise
end
|
---SG Is Here---
---Please Dont Change Anything Can Dont Work If You Change-- |
function onClick()
script.Parent.Parent.Active = false
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.ReFrame.Active = true
script.Parent.Parent.Parent.ReFrame.Visible = true
end
script.Parent.MouseButton1Click:connect(onClick)
|
--= Made by Interactivity ==--
--= Place this in StarterGui =-- | |
--[=[
@param ignorePlayer Player -- The client to ignore
@param ... any -- Arguments passed to the other clients
Fires the signal to all clients _except_ the specified
client.
:::note Outbound Middleware
All arguments pass through any outbound middleware (if any)
before being sent to the clients.
:::
]=] |
function RemoteSignal:FireExcept(ignorePlayer: Player, ...: any)
self:FireFilter(function(plr)
return plr ~= ignorePlayer
end, ...)
end
|
-- Decompiled with the Synapse X Luau decompiler. |
local l__HDAdminGUIs__1 = game.Players.LocalPlayer.PlayerGui:WaitForChild("HDAdminGUIs");
l__HDAdminGUIs__1.MainFrame.Pages.Admin.Changed:connect(function()
if l__HDAdminGUIs__1.MainFrame.Pages.Admin.Visible == true then
l__HDAdminGUIs__1.MainFrame.Pages.Admin.Visible = false;
end;
end);
|
-- The maximum is 1. Volumes set above 1 will be unaffected.
-- For music heard across the game, if you have other sounds, put this to 0.9 or 1, otherwise you won't hear your music because of the other sounds
-- |
music.Looped = false -- This determines if the sound will repeat forever. If you have more than one sound, you MUST set this to false, otherwise you will be able to |
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================ |
local function GetMass(parent)
local mass = 0
for _,v in pairs(parent:GetChildren()) do
if (v:IsA("BasePart") or v:IsA("MeshPart")) then
if not v.Massless then
mass = (mass + v:GetMass())
end
end
mass = mass + GetMass(v)
end
return mass
end -- GetMass()
local function SetMassless(parent, self)
for _,part in pairs(parent:GetDescendants()) do
if ((part:IsA("BasePart") or part:IsA("MeshPart")) and (part ~= self.main)) then
part.Massless = true
end
end
end -- SetMassless
|
-- Modules |
Utils = require(SharedModules:WaitForChild("Utilities"))
Ragdoll = require(ServerStorage.Modules.Ragdoll)
|
--[[
Main RenderStep Update. The camera controller and occlusion module both have opportunities
to set and modify (respectively) the CFrame and Focus before it is set once on CurrentCamera.
The camera and occlusion modules should only return CFrames, not set the CFrame property of
CurrentCamera directly.
--]] |
function CameraModule:Update(dt)
if self.activeCameraController then
if FFlagUserCameraToggle then
self.activeCameraController:UpdateMouseBehavior()
end
local newCameraCFrame, newCameraFocus = self.activeCameraController:Update(dt)
self.activeCameraController:ApplyVRTransform()
if self.activeOcclusionModule then
newCameraCFrame, newCameraFocus = self.activeOcclusionModule:Update(dt, newCameraCFrame, newCameraFocus)
end
-- Here is where the new CFrame and Focus are set for this render frame
game.Workspace.CurrentCamera.CFrame = newCameraCFrame
game.Workspace.CurrentCamera.Focus = newCameraFocus
-- Update to character local transparency as needed based on camera-to-subject distance
if self.activeTransparencyController then
self.activeTransparencyController:Update()
end
end
end
|
-- Signal:Fire(...) implemented by running the handler functions on the
-- coRunnerThread, and any time the resulting thread yielded without returning
-- to us, that means that it yielded to the Roblox scheduler and has been taken
-- over by Roblox scheduling, meaning we have to make a new coroutine runner. |
function Signal:Fire(...)
local item = self._handlerListHead
while item do
if item._connected then
if not freeRunnerThread then
freeRunnerThread = coroutine.create(runEventHandlerInFreeThread)
end
task.spawn(freeRunnerThread, item._fn, ...)
end
item = item._next
end
end
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
ZoneModelName = "Error insanity big bone" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--- Constants used to decide when to notify that the chat filter is having issues filtering messages. |
local FILTER_NOTIFCATION_THRESHOLD = 3 --Number of notifcation failures before an error message is output.
local FILTER_NOTIFCATION_INTERVAL = 60 --Time between error messages.
local FILTER_THRESHOLD_TIME = 60 --If there has not been an issue in this many seconds, the count of issues resets.
local module = {}
local RunService = game:GetService("RunService")
local Chat = game:GetService("Chat")
local ReplicatedModules = Chat:WaitForChild("ClientChatModules")
local modulesFolder = script.Parent
local ReplicatedModules = Chat:WaitForChild("ClientChatModules")
local ChatSettings = require(ReplicatedModules:WaitForChild("ChatSettings"))
local errorTextColor = ChatSettings.ErrorMessageTextColor or Color3.fromRGB(245, 50, 50)
local errorExtraData = {ChatColor = errorTextColor}
|
--// Ammo Settings |
Ammo = 25;
StoredAmmo = 33;
MagCount = math.huge; -- If you want infinate ammo, set to math.huge EX. MagCount = math.huge;
ExplosiveAmmo = 3;
|
-- Update the previous floor material and current floor material |
humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
getFloorMaterial()
getSoundProperties()
update()
if humanoid.MoveDirection.Magnitude > 0 then
currentSound.Playing = true
end
end)
|
---------------------------------- |
local mouse = player:GetMouse()
local car = script.Parent:WaitForChild("Car").Value
local enabled = false
local char = car.DriveSeat.SeatWeld.Part1
|
--Checks for collisions---------- |
local function CheckHitbox(Character, Object, Plot)
if not Object then return false end
local CollisionPoints = workspace:GetPartsInPart(Object.PrimaryPart)
--Checks if there is collision on any object that is not a child and is not the player----------
for i = 1, #CollisionPoints, 1 do
if not CollisionPoints[i].CanTouch then continue end
if not (not CollisionPoints[i]:IsDescendantOf(Object) and not CollisionPoints[i]:IsDescendantOf(Character)) and not (CollisionPoints[i] == Plot) then continue end
return true
end
return false
end
|
------------------------------------------------------------------------
-- check whether list has any jump that do not produce a value
-- (or produce an inverted value)
-- * return value changed to boolean
-- * used only in luaK:exp2reg()
------------------------------------------------------------------------ |
function luaK:need_value(fs, list)
while list ~= self.NO_JUMP do
local i = self:getjumpcontrol(fs, list)
if luaP:GET_OPCODE(i) ~= "OP_TESTSET" then return true end
list = self:getjump(fs, list)
end
return false -- not found
end
|
--[[
hitsound.Volume=.5+(.5*math.random())
hitsound.Pitch=.5+math.random()
hitsound:Play()
--]] |
if RightShoulder and LeftShoulder then
RightShoulder.CurrentAngle=0
LeftShoulder.CurrentAngle=0
end
end
end
lastattack=time
end
end
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
Humanoid.PlatformStanding:connect(onPlatformStanding)
function populatehumanoids(mdl)
if mdl.ClassName=="Humanoid" then
table.insert(humanoids,mdl)
end
for i2,mdl2 in ipairs(mdl:GetChildren()) do
populatehumanoids(mdl2)
end
end |
--// ToDo: Move to common modules |
function methods:WaitUntilParentedCorrectly()
while (not self.GuiObject:IsDescendantOf(game:GetService("Players").LocalPlayer)) do
self.GuiObject.AncestryChanged:wait()
end
end
|
--[[
Returns true if there is a cached appearance for specified userId, otherwise returns false
]] |
function CharacterAppearanceCache.hasCached(userId)
if appearanceCache[tostring(userId)] then
return true
else
return false
end
end
|
--[[
___ _______ _ _______
/ _ |____/ ___/ / ___ ____ ___ (_)__ /__ __/
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< / /
/_/ |_| \___/_//_/\_,_/___/___/_/___/ /_/
SecondLogic @ Inspare
Avxnturador @ Novena
]] |
local autoscaling = true --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 370 ,
spInc = 40 , -- Increment between labelled notches
},
}
|
-- DO NOT EDIT THE BELOW UNLESS YOU'RE A SCRIPTER AND KNOW WHAT YOU'RE DOING! -- |
local songValues = {}
local songs = script.Parent:GetChildren()
for i,v in pairs(songs) do
if v:IsA("IntValue") and v.Name == "MusicId" then
table.insert(songValues, v.Value)
end
end
local sound = Instance.new("Sound",script.Parent)
sound.Name = "MusicPlayer"
if looped == true then
sound.Looped = true
else
sound.Looped = false
end
sound.Pitch = pitch
sound.Volume = volume
while true do
sound.SoundId = "rbxassetid://"..songValues[math.random(1,#songValues)]
sound:Play()
wait(songPlayTime)
sound:Stop()
wait(nextSongPlayTime)
end
|
--[[Weld functions]] |
local JS = game:GetService("JointsService")
local PGS_ON = workspace:PGSIsEnabled()
function MakeWeld(x,y,type,s)
if type==nil then type="Weld" end
local W=Instance.new(type,JS)
W.Part0=x W.Part1=y
W.C0=x.CFrame:inverse()*x.CFrame
W.C1=y.CFrame:inverse()*x.CFrame
if type=="Motor" and s~=nil then
W.MaxVelocity=s
end
return W
end
function ModelWeld(a,b)
if a:IsA("BasePart") and
a.Parent.Name ~= ("RotLight") then
MakeWeld(b,a,"Weld")
for i,v in pairs(a:GetChildren()) do
if v ~= nil and v:IsA("BasePart") then
ModelWeld(v,b)
end
end
elseif a:IsA("Model") then
for i,v in pairs(a:GetChildren()) do
ModelWeld(v,b)
end
end
end
function UnAnchor(a)
if a:IsA("BasePart") then a.Anchored=false end for i,v in pairs(a:GetChildren()) do UnAnchor(v) end
end
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
ZoneModelName = "error string" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--[[Engine]] |
-- [TORQUE CURVE VISUAL]
-- https://www.desmos.com/calculator/nap6stpjqf
-- Use sliders to manipulate values
-- Edit everything as if your car is NATURALLY aspirated, or as if it lacks a turbo.
Tune.Horsepower = 950
Tune.IdleRPM = 700
Tune.PeakRPM = 7000
Tune.Redline = 8500
Tune.EqPoint = 5252
Tune.PeakSharpness = 20
Tune.CurveMult = 0.2
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Turbo Settings
Tune.Aspiration = "Single" --[[
[Aspiration]
"Natural" : N/A, Naturally aspirated engine
"Single" : Single turbocharger
"Double" : Twin turbocharger ]]
Tune.Boost = 30 --Max PSI per turbo (If you have two turbos and this is 15, the PSI will be 30)
Tune.TurboSize = 54 --Turbo size; the bigger it is, the more lag it has.
Tune.CompressRatio = 9 --The compression ratio (look it up)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response, lower = more stable RPM)
|
--// Unused (Don't delete) |
RestMode = false;
AttachmentsEnabled = true;
UIScope = false;
CanSlideLock = false;
|
--[Basically, Makea brick that is called "T1" for the person to touch , Then make a brick called "Dest" for where they will teleport to, simplez] | |
--!strict |
return {
concat = require(script.concat),
every = require(script.every),
filter = require(script.filter),
find = require(script.find),
findIndex = require(script.findIndex),
forEach = require(script.forEach),
from = require(script.from),
includes = require(script.includes),
indexOf = require(script.indexOf),
isArray = require(script.isArray),
join = require(script.join),
map = require(script.map),
reduce = require(script.reduce),
reverse = require(script.reverse),
shift = require(script.shift),
slice = require(script.slice),
some = require(script.some),
sort = require(script.sort),
splice = require(script.splice),
unshift = require(script.unshift),
}
|
--[[Transmission]] |
Tune.TransModes = {"Auto", "Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 6.20 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 5 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 1.99 ,
--[[ 3 ]] 1.25 ,
--[[ 4 ]] 0.98 ,
--[[ 5 ]] 0.71 ,
--[[ 6 ]] 0.54 ,
--[[ 7 ]] 0.45 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--print("intFindPath") |
function Zombie:FindPath()
for k, v in pairs(WayPoints) do
if v.Name == "WayPoint" .. tostring(Shetchik) then
--print(v.Name)
Shetchik += 1
return v.Position
end
end
return nil
end
|
--[[
if time>nextsound then
playsound(time)
end
--]] |
if time>nextjump then
nextjump=time+7+(math.random()*5)
Humanoid.Jump=true
end
animate(time)
end
wait(4)
sp:remove() --Rest In Pizza
|
-- Channel Functions -- |
function ChannelDown()
channel.Value = channel.Value - 1
end
TV.CButtonDown.ClickDetector.MouseClick:Connect(ChannelDown)
function ChannelUp()
channel.Value = channel.Value + 1
end
TV.CButtonUp.ClickDetector.MouseClick:Connect(ChannelUp)
local function ChangeChannel()
if channel.Value < 1 then -- If the VALUE is 0, the script won't work bc the value is nil on the tables.
channel.Value = MaxChannel -- You can change the MaxChannel value if you like.
elseif channel.Value > MaxChannel then
channel.Value = 1
else
music.SoundId = songs[channel.Value]
music:Play()
img.Texture = images[channel.Value]
end
end
channel.Changed:Connect(ChangeChannel)
|
--[=[
Use to test that the given GuiObject or Rect is above the other GuiObject or
Rect.
The last argument is optional. If nil, the matcher will pass only if the
difference **bottom** edge of the given GuiObject or Rect and the **top**
edge of the other GuiObject or Rect is zero or positive.
Usage:
```lua
expect(a).toBeAbove(b) -- Jest
expect(a).to.be.above(b) -- TestEZ
```
.png)
```lua
expect(a).toBeAbove(b, 5) -- Jest
expect(a).to.be.above(b, 5) -- TestEZ
```
.png)
```lua
expect(a).toBeAbove(b, NumberRange.new(0, 5)) -- Jest
expect(a).to.be.above(b, NumberRange.new(0, 5)) -- TestEZ
```
).png)
@tag outside
@within CollisionMatchers2D
]=] |
local function above(a: GuiObject | Rect, b: GuiObject | Rect, distance: number)
local aRect = toRect(a)
local bRect = toRect(b)
local distanceFromSide = -(aRect.Max - bRect.Min)
if distance then
if typeof(distance) == "number" then
distance = NumberRange.new(distance)
end
return returnValue(
distance.Min <= distanceFromSide.Y and distance.Max >= distanceFromSide.Y,
"Was within range",
"Was not within range ( " .. tostring(distance) .. ")"
)
else
return returnValue(distanceFromSide.Y >= 0, "Was above the element", "Was below the element")
end
end
return above
|
--[[**
<description>
Add a function to be called before the game closes. Fired with the player and value of the data store.
</description>
<parameter name = "callback">
The callback function.
</parameter>
**--]] |
function DataStore:BindToClose(callback)
table.insert(self.bindToClose, callback)
end
|
--[[
Exposes a single instance of a configuration as Roact's GlobalConfig.
]] |
local Config = require(script.Parent.Config)
return Config.new()
|
--DriveSeat.ChildAdded:Connect(autoLight) |
DriveSeat.ChildRemoved:Connect(leavedriveseat)
Values.Brake.Changed:Connect(brakes)
Values.Gear.Changed:Connect(reverse)
LightEvent:FireServer("Setup", Low_Beam_Color, High_Beam_Color, Running_Light_Color, Front_Indicator_Color, Rear_Indicator_Color, Fog_Light_Color, Popups_Enabled, Plate_Lights, Plate_Light_Color, Trunk_Lights, Mirror_Indicators, Running_Light_Location, Fade_Time, Indicator_Flash_Rate)
local co2 = coroutine.create(function()
while wait() do
if Sequential_Indicators then
if LI.Value then
RI.Value = false
H.Value = false
script.ClickOn:Play()
TweenService:Create(script.Parent.LeftInd, indgui_tweeninfo, {ImageTransparency = 0}):Play()
for i = 1, Sequential_Segments do
LightEvent:FireServer("SignalLeft", 0, 0.02, Indicator_Type, Sequential_Indicators, i)
wait(Indicator_Flash_Rate / Sequential_Segments)
end
wait(0.1)
script.ClickOff:Play()
TweenService:Create(script.Parent.LeftInd, indgui_tweeninfo, {ImageTransparency = 1}):Play()
LightEvent:FireServer("SignalLeft", 0, 1, Indicator_Type, Sequential_Indicators, 1)
wait(Indicator_Flash_Rate)
else
LightEvent:FireServer("SignalLeft", 0, 1, Indicator_Type, Sequential_Indicators, 1)
end
if RI.Value then
LI.Value = false
H.Value = false
script.ClickOn:Play()
TweenService:Create(script.Parent.RightInd, indgui_tweeninfo, {ImageTransparency = 0}):Play()
for i = 1, Sequential_Segments do
LightEvent:FireServer("SignalRight", 0, 0.02, Indicator_Type, Sequential_Indicators, i)
wait(Indicator_Flash_Rate / Sequential_Segments)
end
wait(0.1)
script.ClickOff:Play()
TweenService:Create(script.Parent.RightInd, indgui_tweeninfo, {ImageTransparency = 1}):Play()
LightEvent:FireServer("SignalRight", 0, 1, Indicator_Type, Sequential_Indicators, 1)
wait(Indicator_Flash_Rate)
else
LightEvent:FireServer("SignalRight", 0, 1, Indicator_Type, Sequential_Indicators, 1)
end
if H.Value then
LI.Value = false
RI.Value = false
script.ClickOn:Play()
TweenService:Create(script.Parent.LeftInd, indgui_tweeninfo, {ImageTransparency = 0}):Play()
TweenService:Create(script.Parent.RightInd, indgui_tweeninfo, {ImageTransparency = 0}):Play()
for i = 1, Sequential_Segments do
LightEvent:FireServer("Hazards", 0, 0.02, Indicator_Type, Sequential_Indicators, i)
wait(Indicator_Flash_Rate / Sequential_Segments)
end
wait(0.1)
script.ClickOff:Play()
TweenService:Create(script.Parent.LeftInd, indgui_tweeninfo, {ImageTransparency = 1}):Play()
TweenService:Create(script.Parent.RightInd, indgui_tweeninfo, {ImageTransparency = 1}):Play()
LightEvent:FireServer("Hazards", 0, 1, Indicator_Type, Sequential_Indicators, 1)
wait(Indicator_Flash_Rate)
else
LightEvent:FireServer("Hazards", 0, 1, Indicator_Type, Sequential_Indicators, 1)
end
end
end
end)
local co = coroutine.create(function()
while wait() do
if not Sequential_Indicators then
if LI.Value then
RI.Value = false
H.Value = false
script.ClickOn:Play()
TweenService:Create(script.Parent.LeftInd, indgui_tweeninfo, {ImageTransparency = 0}):Play()
LightEvent:FireServer("SignalLeft", 1, 0.02, Indicator_Type)
wait(Indicator_Flash_Rate)
script.ClickOff:Play()
TweenService:Create(script.Parent.LeftInd, indgui_tweeninfo, {ImageTransparency = 1}):Play()
if Running_Light_Location == "Low Beam / Indicators" and parklightActive then
LightEvent:FireServer("SignalLeft", 0, 0.71, Indicator_Type)
else
LightEvent:FireServer("SignalLeft", 0, 1, Indicator_Type)
end
wait(Indicator_Flash_Rate)
else
TweenService:Create(script.Parent.LeftInd, indgui_tweeninfo, {ImageTransparency = 1}):Play()
if Running_Light_Location == "Low Beam / Indicators" and parklightActive then
LightEvent:FireServer("SignalLeft", 0, 0.71, Indicator_Type)
else
LightEvent:FireServer("SignalLeft", 0, 1, Indicator_Type)
end
end
if RI.Value then
LI.Value = false
H.Value = false
script.ClickOn:Play()
TweenService:Create(script.Parent.RightInd, indgui_tweeninfo, {ImageTransparency = 0}):Play()
LightEvent:FireServer("SignalRight", 1, 0.02, Indicator_Type)
wait(Indicator_Flash_Rate)
script.ClickOff:Play()
TweenService:Create(script.Parent.RightInd, indgui_tweeninfo, {ImageTransparency = 1}):Play()
if Running_Light_Location == "Indicators" and parklightActive then
LightEvent:FireServer("SignalRight", 0, 0.71, Indicator_Type)
else
LightEvent:FireServer("SignalRight", 0, 1, Indicator_Type)
end
wait(Indicator_Flash_Rate)
else
TweenService:Create(script.Parent.RightInd, indgui_tweeninfo, {ImageTransparency = 1}):Play()
if Running_Light_Location == "Low Beam / Indicators" and parklightActive then
LightEvent:FireServer("SignalRight", 0, 0.71, Indicator_Type)
else
LightEvent:FireServer("SignalRight", 0, 1, Indicator_Type)
end
end
if H.Value then
LI.Value = false
RI.Value = false
script.ClickOn:Play()
TweenService:Create(script.Parent.LeftInd, indgui_tweeninfo, {ImageTransparency = 0}):Play()
TweenService:Create(script.Parent.RightInd, indgui_tweeninfo, {ImageTransparency = 0}):Play()
LightEvent:FireServer("Hazards", 1, 0.02, Indicator_Type)
wait(Indicator_Flash_Rate)
script.ClickOff:Play()
TweenService:Create(script.Parent.LeftInd, indgui_tweeninfo, {ImageTransparency = 1}):Play()
TweenService:Create(script.Parent.RightInd, indgui_tweeninfo, {ImageTransparency = 1}):Play()
if Running_Light_Location == "Low Beam / Indicators" and parklightActive then
LightEvent:FireServer("Hazards", 0, 0.71, Indicator_Type)
else
LightEvent:FireServer("Hazards", 0, 1, Indicator_Type)
end
wait(Indicator_Flash_Rate)
else
TweenService:Create(script.Parent.LeftInd, indgui_tweeninfo, {ImageTransparency = 1}):Play()
TweenService:Create(script.Parent.RightInd, indgui_tweeninfo, {ImageTransparency = 1}):Play()
if Running_Light_Location == "Low Beam / Indicators" and parklightActive then
LightEvent:FireServer("Hazards", 0, 0.71, Indicator_Type)
else
LightEvent:FireServer("Hazards", 0, 1, Indicator_Type)
end
end
end
end
end)
coroutine.resume(co)
coroutine.resume(co2)
|
--Right lean Divider |
R6LeftLegRightLeanD = 3.5
R6RightLegRightLeanD = 3.5
R6LeftArmRightLeanD = 3.5
R6RightArmRightLeanD = 3.5
R6TorsoRightLeanD = 3.5
|
--[[ Initialization/Setup ]] | --
local function createTouchGuiContainer()
if TouchGui then TouchGui:Destroy() end
-- Container for all touch device guis
TouchGui = Instance.new('ScreenGui')
TouchGui.Name = "TouchGui"
TouchGui.Parent = PlayerGui
TouchControlFrame = Instance.new('Frame')
TouchControlFrame.Name = "TouchControlFrame"
TouchControlFrame.Size = UDim2.new(1, 0, 1, 0)
TouchControlFrame.BackgroundTransparency = 1
TouchControlFrame.Parent = TouchGui
ThumbstickModule:Create(TouchControlFrame)
DPadModule:Create(TouchControlFrame)
ThumbpadModule:Create(TouchControlFrame)
TouchJumpModule:Create(TouchControlFrame)
end
|
--[[Susupension]] |
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 500 -- Spring Dampening
Tune.FSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 1000 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FPreCompress = .3 -- Pre-compression adds resting length force
Tune.FExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.FCompressLim = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 500 -- Spring Dampening
Tune.RSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RPreCompress = .3 -- Pre-compression adds resting length force
Tune.RExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.RCompressLim = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = false -- Spring Visible
Tune.WsBVisible = true -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Black" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
-- // Copyright 2023, vracto, All rights reserved. |
local hum = script.Parent:WaitForChild("Humanoid")
local seat = nil
hum.Seated:Connect(function(active, seatPart)
seat = seatPart
end)
local w = false
local s = false
local a = false
local d = false
game:GetService("UserInputService").InputBegan:Connect(function(inp, processed)
if processed then return end
if inp.KeyCode == Enum.KeyCode.W then w = true end
if inp.KeyCode == Enum.KeyCode.S then s = true end
if inp.KeyCode == Enum.KeyCode.A then a = true end
if inp.KeyCode == Enum.KeyCode.D then d = true end
end)
game:GetService("UserInputService").InputEnded:Connect(function(inp)
if inp.KeyCode == Enum.KeyCode.W then w = false end
if inp.KeyCode == Enum.KeyCode.S then s = false end
if inp.KeyCode == Enum.KeyCode.A then a = false end
if inp.KeyCode == Enum.KeyCode.D then d = false end
end)
local camera = workspace.CurrentCamera
local mouse = game.Players.LocalPlayer:GetMouse()
local aa = 0
game:GetService("RunService").RenderStepped:Connect(function()
if seat then
print(a)
print(d)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = seat.Parent.Camera.CFrame * CFrame.Angles(math.rad((((mouse.Y - mouse.ViewSizeY / 2) / mouse.ViewSizeY)) * -20),math.rad((((mouse.X - mouse.ViewSizeX / 2) / mouse.ViewSizeX)) * -20),0)
--seat.BodyGyro.CFrame = CFrame.new(seat.Parent.Body.Position, mouse.Hit.LookVector * 666)
seat.BodyGyro.CFrame = CFrame.new(seat.Position, Vector3.new(mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z)) * CFrame.Angles(0, 0, math.rad(aa))
if w then
seat.BodyVelocity.Velocity = seat.CFrame.LookVector * 100
elseif s then
seat.BodyVelocity.Velocity = seat.CFrame.LookVector * -100
else
seat.BodyVelocity.Velocity = Vector3.new(0, 0, 0)
end
if a then
aa+=3
elseif d then
aa+=-3
else
seat.BodyAngularVelocity.AngularVelocity = Vector3.new(0,0,0)
end
else
camera.CameraType = Enum.CameraType.Custom
end
end)
|
--Automatic Transmission |
function Auto()
local maxSpin=0
for i,v in pairs(Drive) do if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end end
if _IsOn then
_ClutchOn = true
if _CGear >= 1 then
if _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 5 then
_CGear = 1
else
if _Tune.AutoShiftMode == "RPM" then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
if (_CGear ~= 0) and (_CGear ~= #_Tune.Ratios-2) then
_GThrotShift = 0
wait(_Tune.ShiftTime)
_GThrotShift = 1
end
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) then
if _CGear ~= 1 then
_GThrotShift = 0
wait(_Tune.ShiftTime/2)
_GThrotShift = 1
end
_CGear=math.max(_CGear-1,1)
end
else
if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then
if (_CGear ~= 0) and (_CGear ~= #_Tune.Ratios-2) then
_GThrotShift = 0
wait(_Tune.ShiftTime)
_GThrotShift = 1
end
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) then
if _CGear ~= 1 then
_GThrotShift = 0
wait(_Tune.ShiftTime/2)
_GThrotShift = 1
end
_CGear=math.max(_CGear-1,1)
end
end
end
end
end
end
local tqTCS = 1
local sthrot = 0 |
--[=[
Returns whether or not text is only whitespace
@param str string
@return boolean
]=] |
function String.isWhitespace(str: string): boolean
return string.match(str, "[%s]+") == str
end
|
--// F key, Horn |
mouse.KeyDown:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Airhorn:Play()
veh.Lightbar.middle.Wail.Volume = 0
veh.Lightbar.middle.Yelp.Volume = 0
veh.Lightbar.middle.Priority.Volume = 0
veh.Lightbar.middle.Manual.Volume = 0
end
end)
|
--[=[
@class LocalizationServiceUtils
]=] |
local require = require(script.Parent.loader).load(script)
local LocalizationService = game:GetService("LocalizationService")
local RunService = game:GetService("RunService")
local Promise = require("Promise")
local ERROR_PUBLISH_REQUIRED = "Publishing the game is required to use GetTranslatorForPlayerAsync API."
local LocalizationServiceUtils = {}
function LocalizationServiceUtils.promiseTranslator(player)
local asyncTranslatorPromise = Promise.spawn(function(resolve, reject)
local translator = nil
local ok, err = pcall(function()
translator = LocalizationService:GetTranslatorForPlayerAsync(player)
end)
if not ok then
reject(err or "Failed to GetTranslatorForPlayerAsync")
return
end
if translator then
assert(typeof(translator) == "Instance", "Bad translator")
resolve(translator)
return
end
reject("Translator was not returned")
return
end)
-- Give longer in non-studio mode
local timeout = 20
if RunService:IsStudio() then
timeout = 0.5
end
task.delay(timeout, function()
if not asyncTranslatorPromise:IsPending() then
return
end
asyncTranslatorPromise:Reject(
("GetTranslatorForPlayerAsync is still pending after %f, using local table")
:format(timeout))
end)
return asyncTranslatorPromise:Catch(function(err)
if err ~= ERROR_PUBLISH_REQUIRED then
warn(("[LocalizationServiceUtils.promiseTranslator] - %s"):format(tostring(err)))
end
-- Fallback to just local stuff
local translator = LocalizationService:GetTranslatorForPlayer(player)
return translator
end)
end
return LocalizationServiceUtils
|
-- the following data is to update the ObjectTable |
local ValidClassNames = {"Part","WedgePart","TrussPart","Model","Seat","VehicleSeat"}
function isValidClass(part)
local CN = part.className
for i=1,#ValidClassNames do
if(CN == ValidClassNames[i]) then
return true
end
end
return false
end
function isValidPart(part) -- returns className if its a part or model otherwise returns nil
if isValidClass(part) == true then
return part
end
return nil -- not a part or an model
end
function retriveParts(model) -- main function for retriving all the parts of a model and loading them into a table
if(isValidPart(model) and model.className ~= "Model") then
WorkSpaceObjects[WSONum] = model;
WSONum = WSONum + 1;
else
local raw_model = model:GetChildren()
for i=1,#raw_model do
local part = isValidPart(raw_model[i])
if(part ~= nil) then
if(part.className == "Model") then
retriveParts(part);
else
if(part.Anchored == false) then
--if(part:findFirstChild("TAG") == nil) then
-- Tag = Instance.new("ObjectValue")
-- Tag.Parent = part
-- Tag.Name = "TAG"
WorkSpaceObjects[WSONum] = part;
WSONum = WSONum + 1;
--end
end
end
end
end
end
end
function RemoveBits(model) -- Function for removing bits from our global table as they dont exist in the workspace anymore
if(isValidPart(model) and model.className ~= "Model") then
for i=1,#WorkSpaceObjects do
if(model == WorkSpaceObjects[i]) then
table.remove(WorkSpaceObjects,i)
WSONum = WSONum -1
end
end
else
local raw_model = model:GetChildren()
for i=1,#raw_model do
local part = raw_model[i]
if(part.className == "Model") then
RemoveBits(part);
else
for i=1,#WorkSpaceObjects do
if(part == WorkSpaceObjects[i]) then
table.remove(WorkSpaceObjects,i)
WSONum = WSONum -1
end
end
end
end
end
end
retriveParts(game.Workspace); -- call our retreiver
game.Workspace.ChildAdded:connect(retriveParts)-- just encase any new objects get added to the game
game.Workspace.ChildRemoved:connect(RemoveBits) |
-- // Equips & Unequip |
Remotes.Main1.OnServerEvent:Connect(function(plr,firingtype)
local LocalPlayer = plr
local Character = LocalPlayer.Character
for GetType,_ in pairs(GetTable) do
if firingtype == GetType then
--LocalPlayer.PlayerGui.ScreenGui.Folder[Slots].Value = true
--if LocalPlayer.PlayerGui.ScreenGui.Folder[Slots].Value then
if Character:FindFirstChild(GetType) == nil then
local FindWeapons = Weapons[GetType]:Clone()
FindWeapons.Parent = Character
if FindWeapons.WielderType.Value == _.WielderType then
local DefineWeldings = Instance.new("Motor6D")
DefineWeldings.Part0 = Character["Right Arm"]
DefineWeldings.Part1 = FindWeapons.Handle
DefineWeldings.C0 = _.WeldCFrame
DefineWeldings.Parent = Character["Right Arm"]
DefineWeldings.Name = GetType
Name = GetType
end
end
end
end
if firingtype == "Unequip" then
pcall(function()
Character[Name]:Destroy()
end)
end
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 _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.max(_CGear-1,-1)
--Shift Up [Manual Transmission]
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
--Toggle Clutch
elseif _IsOn and (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
_ClutchOn = false
_ClPressing = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClutchOn = true
_ClPressing = false
end
--Toggle PBrake
elseif _IsOn and 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 car.DriveSeat.Velocity.Magnitude>5 then
_PBrake = false
end
end
--Toggle Transmission Mode
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 _IsOn and ((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 then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle/100
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
_GBrake = 1
else
_GBrake = 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
_GThrot = _Tune.IdleThrottle/100
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
--Toggle TCS
elseif _Tune.TCSEnabled 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. ABSEnabled 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 _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_GBrake = 0
if _CGear~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
-- Roact |
local new = Roact.createElement
local Frame = require(UI:WaitForChild 'Frame')
local ImageLabel = require(UI:WaitForChild 'ImageLabel')
local ImageButton = require(UI:WaitForChild 'ImageButton')
local TextLabel = require(UI:WaitForChild 'TextLabel')
local TextBox = require(UI:WaitForChild 'TextBox')
|
--Tune-- |
local StockHP = 150 --Power output desmos: https://www.desmos.com/calculator/wezfve8j90 (does not come with torque curve)
local TurboCount = 1 --(1 = SingleTurbo),(2 = TwinTurbo),(if bigger then it will default to 2 turbos)
local TurboSize = 80 --bigger the turbo, the more lag it has
local WasteGatePressure = 15 --Max PSI for each turbo (if twin and running 10 PSI, thats 10PSI for each turbo)
local CompressionRatio = 9/1 --Compression of your car (look up the compression of the engine you are running)
local AntiLag = true --if true basically keeps the turbo spooled up so less lag
local BOV_Loudness = 2 --volume of the BOV (not exact volume so you kinda have to experiment with it)
local BOV_Pitch = 0.9 --max pitch of the BOV (not exact so might have to mess with it)
local TurboLoudness = 1 --volume of the Turbo (not exact volume so you kinda have to experiment with it also)
|
-- Cleans up the falling object after a delay |
local function objectCleanup(object, cleanupDelay)
delay(cleanupDelay, function()
if object then
object:Destroy()
end
end)
end
|
-- Make signal strict |
setmetatable(Signal, {
__index = function(_tb, key)
error(("Attempt to get Signal::%s (not a valid member)"):format(tostring(key)), 2)
end,
__newindex = function(_tb, key, _value)
error(("Attempt to set Signal::%s (not a valid member)"):format(tostring(key)), 2)
end,
})
return Signal
|
--------------------------------------------------------- |
function conf.waitForOverride() -- waits for server to override conf with gamemode values
while not conf.override do
wait()
end
end
local function _overrideTable(tbl, data)
for k,v in pairs(data) do
if type(v) == "table" then
if not tbl[k] then
tbl[k] = {}
end
_overrideTable(tbl[k], v)
else
tbl[k] = v
end
end
end
function conf.createOverride(name, data)
if _overrides[name] then
print(string.format("Configuration override %s already exists", name))
return
end
_overrides[name] = data
end
function conf.applyOverride(data)
local override
if type(data) == "table" then
override = data
else
override = _overrides[data]
end
if override then
_overrideTable(conf, override)
if isServer then
ConfigEvent:FireAllClients("PropagateConfig", conf)
end
end
return conf
end
if not isServer then
ConfigEvent = ReplicatedStorage:WaitForChild("ConfigEvent")
ConfigEvent.OnClientEvent:Connect(function(cmd, newConf)
if cmd == "PropagateConfig" then
_overrideTable(conf, newConf)
end
end)
else
ConfigEvent = ReplicatedStorage:FindFirstChild("ConfigEvent")
if ConfigEvent == nil then
ConfigEvent = Instance.new("RemoteEvent", ReplicatedStorage)
ConfigEvent.Name = "ConfigEvent"
end
Players.PlayerAdded:Connect(function(player)
ConfigEvent:FireClient(player, "PropagateConfig", conf)
end)
end
|
--[[
Chains a Promise from this one that is resolved if this Promise is
resolved, and rejected if it is not resolved.
]] |
function Promise.prototype:now(rejectionValue)
local traceback = debug.traceback(nil, 2)
if self:getStatus() == Promise.Status.Resolved then
return self:_andThen(traceback, function(...)
return ...
end)
else
return Promise.reject(rejectionValue == nil and Error.new({
kind = Error.Kind.NotResolvedInTime,
error = "This Promise was not resolved in time for :now()",
context = ":now() was called at:\n\n" .. traceback,
}) or rejectionValue)
end
end
Promise.prototype.Now = Promise.prototype.now
|
------------------------
--[[UTIL Functions]]--
------------------------
--Global functions used by all classes are wrapped in UTIL
--deal with it. |
local UTIL = {}
function UTIL.Class(tableIn,template)
tableIn = tableIn or {}
local mt = {
__metatable = UTIL.DeepCopy(template);
__index = UTIL.DeepCopy(template);
}
return setmetatable(tableIn, mt)
end
function UTIL.MakeClass(...)
local arg = {...}
assert(#arg>0, 'ERROR: class needs 1 argument or more')
local members = arg[1]
for i=2,#arg,1 do
if type(arg[i])=='table' then
for key,val in pairs(arg[i]) do
if not members[key] then
members[key] = val
end
end
end
end
local function New(init)
return UTIL.Class(init or {},members)
end
local function Copy(obj, ...)
local newobj = obj:New(unpack(arg))
for n,v in pairs(obj) do newobj[n] = v end
return newobj
end
members.New = New
members.Copy = Copy
return mt
end
function UTIL.DeepCopy(orig)
local orig_type = type(orig)
local copy
if orig_type == 'table' then
copy = {}
for orig_key, orig_value in next, orig, nil do
copy[UTIL.DeepCopy(orig_key)] = UTIL.DeepCopy(orig_value)
end
setmetatable(copy, UTIL.DeepCopy(getmetatable(orig)))
else -- number, string, boolean, etc
copy = orig
end
return copy
end
function UTIL.Instantiate(guiType)
return function(data)
local obj = Instance.new(guiType)
for k, v in pairs(data) do
if type(k) == 'number' then
v.Parent = obj
else
obj[k] = v
end
end
return obj
end
end
function UTIL.RetroRegister(func,...)
func()
for _,i in ipairs({...}) do
i:connect(func)
end
end
|
--[[
Returns the last cached value calculated by this Computed object.
The computed object will be registered as a dependency unless `asDependency`
is false.
]] |
function class:get(asDependency: boolean?): any
if asDependency ~= false then
useDependency(self)
end
return self._value
end
|
--// Services |
local L_106_ = game:GetService('RunService').RenderStepped
local L_107_ = game:GetService('UserInputService')
|
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote |
local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
local PreloadAnimsUserFlag = false
local successPreloadAnim, msgPreloadAnim = pcall(function()
PreloadAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserPreloadAnimations")
end)
if not successPreloadAnim then
PreloadAnimsUserFlag = false
end
math.randomseed(tick())
function configureAnimationSet(name, fileList)
if (animTable[name] ~= nil) then
for _, connection in pairs(animTable[name].connections) do
connection:disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].connections = {}
local allowCustomAnimations = true
local AllowDisableCustomAnimsUserFlag = false
local success, msg = pcall(function()
AllowDisableCustomAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserAllowDisableCustomAnims2")
end)
if (AllowDisableCustomAnimsUserFlag) then
local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end)
if not success then
allowCustomAnimations = true
end
end
-- check for config values
local config = script:FindFirstChild(name)
if (allowCustomAnimations and config ~= nil) then
table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 1
for _, childPart in pairs(config:GetChildren()) do
if (childPart:IsA("Animation")) then
table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject == nil) then
animTable[name][idx].weight = 1
else
animTable[name][idx].weight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
idx = idx + 1
end
end
end
-- fallback to defaults
if (animTable[name].count <= 0) then
for idx, anim in pairs(fileList) do
animTable[name][idx] = {}
animTable[name][idx].anim = Instance.new("Animation")
animTable[name][idx].anim.Name = name
animTable[name][idx].anim.AnimationId = anim.id
animTable[name][idx].weight = anim.weight
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + anim.weight |
--//General functions |
function Switch1()
for i,v in pairs(aparts) do
v.CanCollide = false
v.Transparency = 1
for i,v in pairs(bparts) do
v.CanCollide = true
v.Transparency = 0
end
end
end
function Switch2()
for i,v in pairs(bparts) do
v.CanCollide = false
v.Transparency = 1
for i,v in pairs(aparts) do
v.CanCollide = true
v.Transparency = 0
end
end
end
|
--[[
Identical to Map, except that the result will be reversed.
]] |
function Functional.MapReverse(list, callback)
local new = {}
for key = #list, 1, -1 do
new[key] = callback(list[key], key)
end
return new
end
|
--[=[
Links several instances to a new Janitor, which is then returned.
@param ... Instance -- All the Instances you want linked.
@return Janitor -- A new Janitor that can be used to manually disconnect all LinkToInstances.
]=] |
function Janitor:LinkToInstances(...: Instance)
local ManualCleanup = Janitor.new()
for _, Object in ipairs({...}) do
ManualCleanup:Add(self:LinkToInstance(Object, true), "Disconnect")
end
return ManualCleanup
end
|
--// Functions |
function UpdateTag(plr)
if plr == L_1_ or not plr.Character or not plr.Character:FindFirstChild("TeamTagUI") then return; end;
local Tag = plr.Character:FindFirstChild("TeamTagUI");
if plr.Team == L_1_.Team then
Tag.Enabled = true;
if plr.Character:FindFirstChild("ACS_Client") and plr.Character.ACS_Client:FindFirstChild("FireTeam") and plr.Character.ACS_Client.FireTeam.SquadName.Value ~= "" then
Tag.Frame.Icon.ImageColor3 = plr.Character.ACS_Client.FireTeam.SquadColor.Value;
else
Tag.Frame.Icon.ImageColor3 = Color3.fromRGB(255,255,255);
end;
else
Tag.Enabled = false;
end
end
|
-- Get references to the DockShelf and its children |
local dockShelf = script.Parent.Parent.Parent.Parent.Parent.DockShelf
local aFinderButton = dockShelf.GASettings
local Minimalise = script.Parent
local window = script.Parent.Parent.Parent
|
-- Go through each setting value |
for _, i in pairs(settingVals) do
-- Make sure not nil
if i ~= nil then
-- Connect changed event
i.Changed:connect(function()
-- Set border to be on if this item
if i.Value == itemName and script.Parent.Parent.Player.Value == plr and script.Parent.ItemType.Value ~= "Emote" and itemName ~= "" then
-- Turn on border
script.Parent.GreenEdge.Visible = true
else
-- Check if equip nothing as toy button
if itemName == "" and script.Parent.ItemType.Value == "Toy" then
-- Check if equipped anywhere
local equipped = false
for _, o in pairs(settingVals) do
if o.Value ~= "" then
equipped = true
break
end
end
-- Only turn on border if nothing equipped
if equipped then
script.Parent.GreenEdge.Visible = false
else
script.Parent.GreenEdge.Visible = true
end
else
-- Check if equipped anywhere
local equipped = false
for _, o in pairs(settingVals) do
if o.Value == itemName then
equipped = true
break
end
end
-- Set border accordingly
if not equipped then
script.Parent.GreenEdge.Visible = false
else
script.Parent.GreenEdge.Visible = true
end
end
end
end)
-- Set up
if i.Value == itemName and script.Parent.Parent.Player.Value == plr and script.Parent.ItemType.Value ~= "Emote" and (script.Parent.ItemType.Value ~= "Toy" or itemName ~= "") then
script.Parent.GreenEdge.Visible = true
plr.PlayerGui.MainGui.Inventory.Preview.Item.Value = actualItem
end
end
end
|
--[=[
@return Trove
Constructs a Trove object.
]=] |
function Trove.new()
local self = setmetatable({}, Trove)
self._objects = {}
return self
end
|
--[[Drivetrain]] |
Tune.Config = "AWD" -- "FWD" , "RWD" , "AWD"
Tune.TorqueVector = 0 -- AWD ONLY, "-1" has a 100% front bias, "0" has a 50:50 bias, and "1" has a 100% rear bias. Can be any number between that range.
--Differential Settings
Tune.FDiffSlipThres = 50 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 50 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 80 -- 1 - 100%
Tune.RDiffLockThres = 20 -- 0 - 100%
Tune.CDiffSlipThres = 50 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 50 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = true -- Implements TCS
Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
|
--------------------------------------------------------------------------------------
--------------------[ PRE-LOADING ]---------------------------------------------------
-------------------------------------------------------------------------------------- |
CP:Preload(S.explosionSettings.soundId)
CP:Preload(S.holeSettings.Texture)
CP:Preload(S.sparkSettings.Texture)
CP:Preload(S.smokeSettings.Texture)
CP:Preload(S.bloodSettings.Texture)
CP:Preload("http://www.roblox.com/asset/?id=126877530") --The dark green arrow in the select fire gui
CP:Preload("http://www.roblox.com/asset/?id=55754953") --The circle in the select fire gui
|
-- Don't mess with anything in the script. The constants and variables are all mixed together |
local Type = 0 -- Manipulated by GUI (0 = 12 hr, 1 = 24 hr)
local Sec = false -- Manipulated by GUI
local year = 1970
local month = 1
local day = 1
local Date = "January 1, 1970"
local hour = 0
local min = 0
local sec = 0
local tag = "AM"
local Time = "12:00 AM"
function getDate()
local months = { |
-----------------
--| Constants |--
----------------- |
local BLAST_RADIUS = 8 -- Blast radius of the explosion
local BLAST_DAMAGE = 60 -- Amount of damage done to players
local BLAST_FORCE = 1000 -- Amount of force applied to parts
local IGNORE_LIST = {rocket = 1, handle = 1, effect = 1, water = 1} -- Rocket will fly through things named these |
-- Contstants -- |
local Camera = game.Workspace.CurrentCamera --Now that we fixed this up its time to get to the GUI Part!
local Player = game.Players.LocalPlayer
|
-- Warm water |
faucet.WarmWaterSet.Interactive.ClickDetector.MouseClick:Connect(function()
faucet.Handle:SetPrimaryPartCFrame(faucet.HandleBase.CFrame * CFrame.Angles(math.rad(-90),0,0))
if steam.HotSteam.Enabled == true then
steam.HotSteam.Enabled = false
end
steam.WarmSteam.Enabled = true
p.HotOn.Value = true
p.ColdOn.Value = true
end)
|
--[=[
Pushes an entry to the left of the queue
@param value T
]=] |
function Queue:PushLeft(value)
self._first = self._first - 1
self[self._first] = value
end
|
-- the script ---------------------- |
local effect = script.soundeffect
if level >= 0 and level <= 100 then
effect.HighGain = (level*-1)/2
effect.MidGain = (level*-1)/2
elseif level < 0 then
effect.HighGain = -0
effect.MidGain = -0
elseif level > 100 then
effect.HighGain = -50
effect.MidGain = -50
end
|
--[[**
Alias for t.union
**--]] |
t.some = t.union
|
-- Options: |
local MIN_SIZE = Vector3.new(0.05,0.05,0.05) -- Size of main emitter part when rain inactive
local RAIN_DEFAULT_COLOR = Color3.new(1,1,1) -- Default color3 of all rain elements
local RAIN_DEFAULT_TRANSPARENCY = 0 -- Default transparency scale ratio of all rain elements
local RAIN_DEFAULT_SPEEDRATIO = 1 -- Default speed scale ratio of falling rain effects
local RAIN_DEFAULT_INTENSITYRATIO = 1 -- Default intensity ratio of all rain elements
local RAIN_DEFAULT_LIGHTEMISSION = 0.05 -- Default LightEmission of all rain elements
local RAIN_DEFAULT_LIGHTINFLUENCE = 0.9 -- Default LightInfluence of all rain elements
local RAIN_DEFAULT_DIRECTION = Vector3.new(0,-1,0) -- Default direction for rain to fall into
local RAIN_TRANSPARENCY_T1 = .25 -- Define the shape (time-wise) of the transparency curves for emitters
local RAIN_TRANSPARENCY_T2 = .75
local RAIN_SCANHEIGHT = 1000 -- How many studs to scan up from camera position to determine whether occluded
local RAIN_EMITTER_DIM_DEFAULT = 40 -- Size of emitter block to the side/up
local RAIN_EMITTER_DIM_MAXFORWARD = 100 -- Size of emitter block forwards when looking at the horizon
local RAIN_EMITTER_UP_MODIFIER = 20 -- Maximum vertical displacement of emitter (when looking fully up/down)
local RAIN_SOUND_ASSET = "rbxassetid://1516791621"
local RAIN_SOUND_BASEVOLUME = 0.2 -- Starting volume of rain sound effect when not occluded
local RAIN_SOUND_FADEIN_TIME = 1 -- Tween in/out times for sound volume
local RAIN_SOUND_FADEOUT_TIME = 1
local RAIN_STRAIGHT_ASSET = "rbxassetid://1822883048" -- Some properties of the straight rain particle effect
local RAIN_STRAIGHT_ALPHA_LOW = 0.7 -- Minimum particle transparency for the straight rain emitter
local RAIN_STRAIGHT_SIZE = NumberSequence.new(10)
local RAIN_STRAIGHT_LIFETIME = NumberRange.new(0.8)
local RAIN_STRAIGHT_MAX_RATE = 600 -- Maximum rate for the straight rain emitter
local RAIN_STRAIGHT_MAX_SPEED = 60 -- Maximum speed for the straight rain emitter
local RAIN_TOPDOWN_ASSET = "rbxassetid://1822856633" -- Some properties of the top-down rain particle effect
local RAIN_TOPDOWN_ALPHA_LOW = 0.85 -- Minimum particle transparency for the top-down rain emitter
local RAIN_TOPDOWN_SIZE = NumberSequence.new {
NumberSequenceKeypoint.new(0, 5.33, 2.75);
NumberSequenceKeypoint.new(1, 5.33, 2.75);
}
local RAIN_TOPDOWN_LIFETIME = NumberRange.new(0.8)
local RAIN_TOPDOWN_ROTATION = NumberRange.new(0,360)
local RAIN_TOPDOWN_MAX_RATE = 600 -- Maximum rate for the top-down rain emitter
local RAIN_TOPDOWN_MAX_SPEED = 60 -- Maximum speed for the top-down rain emitter
local RAIN_SPLASH_ASSET = "rbxassetid://1822856633" -- Some properties of the splash particle effect
local RAIN_SPLASH_ALPHA_LOW = 0.6 -- Minimum particle transparency for the splash emitters
local RAIN_SPLASH_SIZE = NumberSequence.new {
NumberSequenceKeypoint.new(0, 0);
NumberSequenceKeypoint.new(.4, 3);
NumberSequenceKeypoint.new(1, 0);
}
local RAIN_SPLASH_LIFETIME = NumberRange.new(0.1, 0.15)
local RAIN_SPLASH_ROTATION = NumberRange.new(0,360)
local RAIN_SPLASH_NUM = 20 -- Amount of splashes per frame
local RAIN_SPLASH_CORRECTION_Y = .5 -- Offset from impact position for visual reasons
local RAIN_SPLASH_STRAIGHT_OFFSET_Y = 50 -- Offset against rain direction for straight rain particles from splash position
local RAIN_NOSPLASH_STRAIGHT_OFFSET_Y_MIN = 20 -- Min/max vertical offset from camera height for straight rain particles
local RAIN_NOSPLASH_STRAIGHT_OFFSET_Y_MAX = 100 -- when no splash position could be found (i.e. no floor at that XZ-column)
local RAIN_OCCLUDED_MINSPEED = 70 -- Minimum speed for the occluded straight rain emitters
local RAIN_OCCLUDED_MAXSPEED = 100 -- Maximum speed for the occluded straight rain emitters
local RAIN_OCCLUDED_SPREAD = Vector2.new(10,10) -- Spread angle for the occluded straight rain emitters
local RAIN_OCCLUDED_MAXINTENSITY = 2 -- How many occluded straight rain particles are emitted for every splash for max intensity
local RAIN_OCCLUDECHECK_OFFSET_Y = 500 -- Vertical offset from camera height to start scanning downward from for splashes
local RAIN_OCCLUDECHECK_OFFSET_XZ_MIN = -100 -- Range of possible XZ offset values from camera XZ position for the splashes
local RAIN_OCCLUDECHECK_OFFSET_XZ_MAX = 100
local RAIN_OCCLUDECHECK_SCAN_Y = 550 -- Scan magnitude along rain path
local RAIN_UPDATE_PERIOD = 6 -- Update the transparency of the main emitters + volume of rain inside every X frames
local RAIN_VOLUME_SCAN_RADIUS = 35 -- Defining grid for checking how far the camera is away from a spot exposed to rain
local RAIN_VOLUME_SCAN_GRID = { -- Unit range grid for scanning how far away user is from rain space
-- range 0.2, 4 pts
Vector3.new(0.141421363, 0, 0.141421363);
Vector3.new(-0.141421363, 0, 0.141421363);
Vector3.new(-0.141421363, 0, -0.141421363);
Vector3.new(0.141421363, 0, -0.141421363);
-- range 0.4, 8 pts
Vector3.new(0.400000006, 0, 0);
Vector3.new(0.282842726, 0, 0.282842726);
Vector3.new(2.44929371e-17, 0, 0.400000006);
Vector3.new(-0.282842726, 0, 0.282842726);
Vector3.new(-0.400000006, 0, 4.89858741e-17);
Vector3.new(-0.282842726, 0, -0.282842726);
Vector3.new(-7.34788045e-17, 0, -0.400000006);
Vector3.new(0.282842726, 0, -0.282842726);
-- range 0.6, 10 pts
Vector3.new(0.600000024, 0, 0);
Vector3.new(0.485410213, 0, 0.352671146);
Vector3.new(0.185410202, 0, 0.570633948);
Vector3.new(-0.185410202, 0, 0.570633948);
Vector3.new(-0.485410213, 0, 0.352671146);
Vector3.new(-0.600000024, 0, 7.34788112e-17);
Vector3.new(-0.485410213, 0, -0.352671146);
Vector3.new(-0.185410202, 0, -0.570633948);
Vector3.new(0.185410202, 0, -0.570633948);
Vector3.new(0.485410213, 0, -0.352671146);
-- range 0.8, 12 pts
Vector3.new(0.772740662, 0, 0.207055241);
Vector3.new(0.565685451, 0, 0.565685451);
Vector3.new(0.207055241, 0, 0.772740662);
Vector3.new(-0.207055241, 0, 0.772740662);
Vector3.new(-0.565685451, 0, 0.565685451);
Vector3.new(-0.772740662, 0, 0.207055241);
Vector3.new(-0.772740662, 0, -0.207055241);
Vector3.new(-0.565685451, 0, -0.565685451);
Vector3.new(-0.207055241, 0, -0.772740662);
Vector3.new(0.207055241, 0, -0.772740662);
Vector3.new(0.565685451, 0, -0.565685451);
Vector3.new(0.772740662, 0, -0.207055241);
}
|
-- Reset the camera look vector when the camera is enabled for the first time |
local SetCameraOnSpawn = true
local hasGameLoaded = false
local GestureArea = nil
|
-- Sample assumes a Main Portal Template model exists under Workspace |
local mainPortal = Workspace:WaitForChild("Main Portal Template")
|
-- move the shelly to the newfound goal |
bg.CFrame = CFrame.new(shelly.PrimaryPart.Position,goal)
bp.Position = (CFrame.new(shelly.PrimaryPart.Position,goal)*CFrame.new(0,0,-100)).p
local start = tick()
repeat wait(1/2)
local ray = Ray.new(shelly.PrimaryPart.Position,Vector3.new(0,-1000,0)) |
-- This store is to be used only on the client. It contains both UI states and data from the server, the latter being
-- synchronized with the server store |
local store = Rodux.Store.new(reducer, nil, { Rodux.thunkMiddleware })
return store
|
--model:remove()
--model.Parent = nil |
wait(5) -- display regen message for 4 seconds
backup.Parent = game.Workspace
backup:makeJoints()
model:Destroy() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.