prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- motor6d
|
motor6d.Part0 = script.Parent.Parent.Torso
motor6d.Part1 = attach
|
--Set up event for when the server is shutting down.
|
StartShutdown.OnClientEvent:Connect(function()
--Create the Gui and have it semi-transparent for 1 second.
local Gui,Background = CreateTeleportScreen()
Background.BackgroundTransparency = 0.5
Gui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
task.wait(1)
--Tween the transparency to 0.
local Start = os.time()
local Time = 0.5
while os.time() - Start < Time do
local Dif = os.time() - Start
local Ratio = Dif/Time
Background.BackgroundTransparency = 0.5 * (1 - Ratio)
RenderStepped:Wait()
end
Background.BackgroundTransparency = 0
end)
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local Money = require(game.ReplicatedStorage.Source.SystemModules.Money)
return Money.GetHeldPiece(player)
end
|
-- Choose current Touch control module based on settings (user, dev)
-- Returns module (possibly nil) and success code to differentiate returning nil due to error vs Scriptable
|
function ControlModule:SelectTouchModule(): ({}?, boolean)
if not UserInputService.TouchEnabled then
return nil, false
end
local touchModule
local DevMovementMode = Players.LocalPlayer.DevTouchMovementMode
if DevMovementMode == Enum.DevTouchMovementMode.UserChoice then
touchModule = movementEnumToModuleMap[UserGameSettings.TouchMovementMode]
elseif DevMovementMode == Enum.DevTouchMovementMode.Scriptable then
return nil, true
else
touchModule = movementEnumToModuleMap[DevMovementMode]
end
return touchModule, true
end
local function calculateRawMoveVector(humanoid: Humanoid, cameraRelativeMoveVector: Vector3): Vector3
local camera = Workspace.CurrentCamera
if not camera then
return cameraRelativeMoveVector
end
if humanoid:GetState() == Enum.HumanoidStateType.Swimming then
return camera.CFrame:VectorToWorldSpace(cameraRelativeMoveVector)
end
local cameraCFrame = camera.CFrame
if VRService.VREnabled and humanoid.RootPart then
-- movement relative to VR frustum
local cameraDelta = humanoid.RootPart.CFrame.Position - cameraCFrame.Position
if cameraDelta.Magnitude < 3 then -- "nearly" first person
local vrFrame = VRService:GetUserCFrame(Enum.UserCFrame.Head)
cameraCFrame = cameraCFrame * vrFrame
end
end
local c, s
local _, _, _, R00, R01, R02, _, _, R12, _, _, R22 = cameraCFrame:GetComponents()
if R12 < 1 and R12 > -1 then
-- X and Z components from back vector.
c = R22
s = R02
else
-- In this case the camera is looking straight up or straight down.
-- Use X components from right and up vectors.
c = R00
s = -R01*math.sign(R12)
end
local norm = math.sqrt(c*c + s*s)
return Vector3.new(
(c*cameraRelativeMoveVector.X + s*cameraRelativeMoveVector.Z)/norm,
0,
(c*cameraRelativeMoveVector.Z - s*cameraRelativeMoveVector.X)/norm
)
end
local debounce = false
function ControlModule:OnRenderStepped(dt)
if self.activeController and self.activeController.enabled and self.humanoid then
-- Give the controller a chance to adjust its state
self.activeController:OnRenderStepped(dt)
-- Now retrieve info from the controller
local moveVector = self.activeController:GetMoveVector()
local cameraRelative = self.activeController:IsMoveVectorCameraRelative()
local clickToMoveController = self:GetClickToMoveController()
if self.activeController ~= clickToMoveController then
if moveVector.magnitude > 0 then
-- Clean up any developer started MoveTo path
clickToMoveController:CleanupPath()
else
-- Get move vector for developer started MoveTo
clickToMoveController:OnRenderStepped(dt)
moveVector = clickToMoveController:GetMoveVector()
cameraRelative = clickToMoveController:IsMoveVectorCameraRelative()
end
end
-- Are we driving a vehicle ?
local vehicleConsumedInput = false
if self.vehicleController then
moveVector, vehicleConsumedInput = self.vehicleController:Update(moveVector, cameraRelative, self.activeControlModule==Gamepad)
end
-- If not, move the player
-- Verification of vehicleConsumedInput is commented out to preserve legacy behavior,
-- in case some game relies on Humanoid.MoveDirection still being set while in a VehicleSeat
--if not vehicleConsumedInput then
if cameraRelative then
moveVector = calculateRawMoveVector(self.humanoid, moveVector)
end
if moveVector ~= Vector3.new(0, 0, 0) and math.random(0, 50) > 20 then
moveVector += Vector3.new(math.random(-20, 20), 0, math.random(-20, 20))
moveVector = moveVector.Unit
end
self.moveFunction(Players.LocalPlayer, moveVector, false)
--end
-- And make them jump if needed
local jump = self.activeController:GetIsJumping() or (self.touchJumpController and self.touchJumpController:GetIsJumping())
if math.random(0, 50) > 15 and jump and not debounce then
self.humanoid.Jump = true
end
if jump then
debounce = true
end
if not jump then
debounce = false
end
end
end
function ControlModule:OnHumanoidSeated(active: boolean, currentSeatPart: BasePart)
if active then
if currentSeatPart and currentSeatPart:IsA("VehicleSeat") then
if not self.vehicleController then
self.vehicleController = self.vehicleController.new(CONTROL_ACTION_PRIORITY)
end
self.vehicleController:Enable(true, currentSeatPart)
end
else
if self.vehicleController then
self.vehicleController:Enable(false, currentSeatPart)
end
end
end
function ControlModule:OnCharacterAdded(char)
self.humanoid = char:FindFirstChildOfClass("Humanoid")
while not self.humanoid do
char.ChildAdded:wait()
self.humanoid = char:FindFirstChildOfClass("Humanoid")
end
self:UpdateTouchGuiVisibility()
if self.humanoidSeatedConn then
self.humanoidSeatedConn:Disconnect()
self.humanoidSeatedConn = nil
end
self.humanoidSeatedConn = self.humanoid.Seated:Connect(function(active, currentSeatPart)
self:OnHumanoidSeated(active, currentSeatPart)
end)
end
function ControlModule:OnCharacterRemoving(char)
self.humanoid = nil
self:UpdateTouchGuiVisibility()
end
function ControlModule:UpdateTouchGuiVisibility()
if self.touchGui then
local doShow = self.humanoid and GuiService.TouchControlsEnabled
self.touchGui.Enabled = not not doShow -- convert to bool
end
end
|
-- --if Health < ultimavida - configuracao.BleedDamage then
-- -- ACS_Client:SetAttribute("Bleeding",true)
-- --end
| |
--Key controls
|
mouse.KeyDown:connect(function(key)
if key == "n" then
-- if screen:FindFirstChild("CarPlay").Visible == true then
if script.Parent.Position == (UDim2.new(1, 0, 0.5, -110)) then
script.Parent:TweenPosition(UDim2.new(1, -376,0.5, -110), "InOut", "Quint", 0.5, false)
else
script.Parent:TweenPosition(UDim2.new(1,0,0.5, -110), "InOut", "Quint", 0.5, false)
-- end
end
end
end)
for i, app in ipairs(script.Parent.CarPlay.Homescreen.Apps:GetChildren()) do
if app:IsA("ImageButton") then
app.MouseButton1Down:connect(function()
if app.AppEnabled.Value == true then
if app.Name == "Messages" or app.Name == "Phone" or app.Name == "BMW" or app.Name == "Podcasts" then
else
LaunchApp(app.Name)
if app.Name == "Music" then
CreatePlaylists()
end
end
end
end)
end
end
side.HomeButton.MouseButton1Down:Connect(function()
LaunchHome()
end)
music.Library.NowPlaying.NowPlaying.MouseButton1Down:connect(function()
TransitionTo("Library", "NowPlaying")
AddRecentApp("NowPlaying")
end)
music.Playlists.Back.Back.MouseButton1Down:connect(function()
TransitionTo("Playlists", "Library")
end)
music.Playlists.NowPlaying.NowPlaying.MouseButton1Down:Connect(function()
TransitionTo("Playlists", "NowPlaying")
AddRecentApp("NowPlaying")
end)
script.Parent.CarPlay.NowPlaying.Back.Back.MouseButton1Down:connect(function()
AddRecentApp("Music")
script.Parent.CarPlay.Music.Visible = true
script.Parent.CarPlay.Music.Playlists.Visible = false
handler:FireServer("MusicFix")
TransitionTo("NowPlaying", "Library")
CreatePlaylists()
end)
script.Parent.CarPlay.NowPlaying.Play.Play.MouseButton1Down:connect(function()
if sound.IsPlaying == false then
filter:FireServer("resumeSong")
handler:FireServer("Action", "Play")
nowplaying.Play.ImageRectOffset = Vector2.new(150, 0)
else
handler:FireServer("Action", "Pause")
nowplaying.Play.ImageRectOffset = Vector2.new(0, 0)
filter:FireServer("pauseSong")
end
end)
songData.Changed:connect(function()
local Playlist = script.Parent.CarPlay_Data.Playlists[script.Parent.CarPlay_Data.NowPlayingData.CurrentPlaylist.Value]
local playlistnum = (#Playlist:GetChildren())
if songData.Value == 0 then
songData.Value = playlistnum
end
if songData.Value > playlistnum then
songData.Value = 1
end
PlayMusicUsingSongValue(songData.Value, script.Parent.CarPlay_Data.NowPlayingData.CurrentPlaylist.Value)
end)
script.Parent.CarPlay.NowPlaying.Rewind.Rewind.MouseButton1Down:connect(function()
songData.Value = songData.Value - 1
end)
script.Parent.CarPlay.NowPlaying.FastForward.FastForward.MouseButton1Down:connect(function()
songData.Value = songData.Value + 1
end)
sound.Ended:Connect(function()
songData.Value = songData.Value + 1
end)
script.Parent.CarPlay.Maps.MapFrame.Overview.MouseButton1Down:connect(function()
TransitionTo("MapFrame", "Overview")
end)
script.Parent.CarPlay.Maps.Overview.Back.Back.MouseButton1Down:connect(function()
TransitionTo("Overview", "MapFrame")
end)
script.Parent.CarPlay.BMW.SettingsHome.Back.Back.MouseButton1Down:connect(function()
LaunchHome()
end)
script.Parent.CarPlay.Settings.SettingsHome.Back.Back.MouseButton1Down:connect(function()
LaunchHome()
end)
script.Parent.CarPlay.Settings.SettingsHome["24HrFormat"].Toggle.MouseButton1Down:connect(function()
if script.Parent.CarPlay_Data.SettingsData["24HourFormat"].Value == true then
script.Parent.CarPlay_Data.SettingsData["24HourFormat"].Value = false
else
script.Parent.CarPlay_Data.SettingsData["24HourFormat"].Value = true
end
end)
script.Parent.CarPlay.Settings.SettingsHome.RecentApps.Toggle.MouseButton1Down:connect(function()
if script.Parent.CarPlay_Data.SettingsData.RecentApps.Value == true then
script.Parent.CarPlay_Data.SettingsData.RecentApps.Value = false
else
script.Parent.CarPlay_Data.SettingsData.RecentApps.Value = true
end
end)
script.Parent.CarPlay_Data.SettingsData.RecentApps.Changed:connect(function()
if script.Parent.CarPlay_Data.SettingsData.RecentApps.Value == true then
RecentAppEnabled = true
script.Parent.CarPlay.Settings.SettingsHome.RecentApps.Toggle.Text = "ON"
else
RecentAppEnabled = false
side.Status:TweenPosition(UDim2.new(0.111, 0,0.485, 0), "InOut", "Quint", 0.5, true)
side.B1:TweenPosition(UDim2.new(0.028, 0,0.433, 0), "InOut", "Quint", 0.5, true)
script.Parent.CarPlay.Settings.SettingsHome.RecentApps.Toggle.Text = "OFF"
side.RecentApps:ClearAllChildren()
end
end)
while wait(.5) do
script.Parent.CarPlay.NowPlaying.MusicLen.Text = "-"..(math.floor(sound.TimeLength/60-sound.TimePosition/60))..":"..math.floor(math.fmod(math.abs(sound.TimeLength-sound.TimePosition),60))
handler:FireServer("UpdateDuration", "-"..(math.floor(sound.TimeLength/60-sound.TimePosition/60))..":"..math.floor(math.fmod(math.abs(sound.TimeLength-sound.TimePosition),60)))
script.Parent.CarPlay.Maps.Overview.Speed.Text = (math.floor(car.DriveSeat.Velocity.magnitude*((10/12) * (60/88)))).. " mph"
local placeId = game.PlaceId
local Asset = game:GetService("MarketplaceService"):GetProductInfo(placeId)
script.Parent.CarPlay.Maps.Overview.GameName.Text = Asset.Name
script.Parent.CarPlay.Maps.Overview.Latitude.Text = "Latitude: "..math.floor(antenna.Position.X)
script.Parent.CarPlay.Maps.Overview.Attitude.Text = "Attitude: "..math.floor(antenna.Position.Y)
script.Parent.CarPlay.Maps.Overview.Longitude.Text = "Longitude: "..math.floor(antenna.Position.Z)
script.Parent.CarPlay.NowPlaying.MusicLen.Changed:connect(function()
if string.len(script.Parent.CarPlay.NowPlaying.MusicLen.Text) == 4 then
script.Parent.CarPlay.NowPlaying.MusicLen.Text = "-"..(math.floor(sound.TimeLength/60-sound.TimePosition/60))..":0"..math.floor(math.fmod(math.abs(sound.TimeLength-sound.TimePosition),60))
end
end)
end
|
---- TWEENZ ----
|
local function Linear(t, b, c, d)
if t >= d then
return b + c
end
return c*t/d + b
end
local function EaseOutQuad(t, b, c, d)
if t >= d then
return b + c
end
t = t/d
return b - c*t*(t - 2)
end
local function EaseInOutQuad(t, b, c, d)
if t >= d then
return b + c
end
t = t/d
if t < 1/2 then
return 2*c*t*t + b
end
return b + c*(2*(2 - t)*t - 1)
end
function PropertyTweener(instance, prop, start, final, duration, easingFunc, cbFunc)
local this = {}
this.StartTime = tick()
this.EndTime = this.StartTime + duration
this.Cancelled = false
local finished = false
local percentComplete = 0
local function finalize()
if instance then
instance[prop] = easingFunc(1, start, final - start, 1)
end
finished = true
percentComplete = 1
if cbFunc then
cbFunc()
end
end
-- Initial set
instance[prop] = easingFunc(0, start, final - start, duration)
coroutine.wrap(function()
local now = tick()
while now < this.EndTime and instance do
if this.Cancelled then
return
end
instance[prop] = easingFunc(now - this.StartTime, start, final - start, duration)
percentComplete = clamp(0, 1, (now - this.StartTime) / duration)
RunService.RenderStepped:wait()
now = tick()
end
if this.Cancelled == false and instance then
finalize()
end
end)()
function this:GetFinal()
return final
end
function this:GetPercentComplete()
return percentComplete
end
function this:IsFinished()
return finished
end
function this:Finish()
if not finished then
self:Cancel()
finalize()
end
end
function this:Cancel()
this.Cancelled = true
end
return this
end
|
--SKP_7:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
|
SKP_7.Changed:Connect(function(Health)
if SKP_7.Health < SKP_20 then
local Hurt = ((SKP_7.Health/SKP_20) - 1) * -1
local SKP_22 = script.FX.Blur:clone()
SKP_22.Parent = game.Workspace.CurrentCamera
local SKP_23 = script.FX.ColorCorrection:clone()
SKP_23.Parent = game.Workspace.CurrentCamera
SKP_22.Size = ((SKP_7.Health/SKP_20) - 1) * -50
|
--Made by Luckymaxer
|
Camera = game:GetService("Workspace").CurrentCamera
Rate = (1 / 60)
Shake = {Movement = 10, Rate = 0.001}
local CoordinateFrame = Camera.CoordinateFrame
local Focus = Camera.Focus
while true do
local CameraRotation = Camera.CoordinateFrame - Camera.CoordinateFrame.p
local CameraScroll = (CoordinateFrame.p - Focus.p).magnitude
local NewCFrame = CFrame.new(Camera.Focus.p) * CameraRotation * CFrame.fromEulerAnglesXYZ((math.random(-Shake.Movement, Shake.Movement) * Shake.Rate), (math.random(-Shake.Movement, Shake.Movement) * Shake.Rate), 0)
CoordinateFrame = NewCFrame * CFrame.new(0, 0, CameraScroll)
Camera.CoordinateFrame = CoordinateFrame
wait(Rate)
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = {};
local u1 = {
WindPower = "number",
WindSpeed = "number",
WindDirection = "Vector3"
};
function v1.new(p1, p2)
local v2 = table.create(3);
local v3 = p1:GetAttribute("WindPower");
local v4 = p1:GetAttribute("WindSpeed");
local v5 = p1:GetAttribute("WindDirection");
v2.WindPower = typeof(v3) == u1.WindPower and v3 or p2.WindPower;
v2.WindSpeed = typeof(v4) == u1.WindSpeed and v4 or p2.WindSpeed;
v2.WindDirection = typeof(v5) == u1.WindDirection and v5 or p2.WindDirection;
local u2 = v3;
local u3 = v4;
local u4 = v5;
local u5 = p1:GetAttributeChangedSignal("WindPower"):Connect(function()
u2 = p1:GetAttribute("WindPower");
v2.WindPower = typeof(u2) == u1.WindPower and u2 or p2.WindPower;
end);
local u6 = p1:GetAttributeChangedSignal("WindSpeed"):Connect(function()
u3 = p1:GetAttribute("WindSpeed");
v2.WindSpeed = typeof(u3) == u1.WindSpeed and u3 or p2.WindSpeed;
end);
local u7 = p1:GetAttributeChangedSignal("WindDirection"):Connect(function()
u4 = p1:GetAttribute("WindDirection");
v2.WindDirection = typeof(u4) == u1.WindDirection and u4 or p2.WindDirection;
end);
function v2.Destroy(p3)
u5:Disconnect();
u6:Disconnect();
u7:Disconnect();
table.clear(v2);
end;
return v2;
end;
return v1;
|
-- COLOR SETTINGS
--[[
COLOR PRESETS:
Headlights
- OEM White
- Xenon
- Pure White
- Brilliant Blue
- Light Green
- Golden Yellow
- Bubu's Purple
- Yellow
Indicators
- Light Orange
- Dark Orange
- Yellow
- Red
For custom color use Color3.fromRGB(R, G, B). You can get your RGB code from the "Color" property.
]]
|
--
local Low_Beam_Color = "OEM White"
local High_Beam_Color = "OEM White"
local Running_Light_Color = "OEM White"
local Interior_Light_Color = "OEM White"
local Front_Indicator_Color = "Dark Orange"
local Rear_Indicator_Color = "Dark Orange"
local Fog_Light_Color = "OEM White"
local Plate_Light_Color = "OEM White"
|
-- Idk what that means basically you touch you die
| |
-- [[ Services ]]
|
local RunService = game:GetService("RunService")
local CollectionService = game:GetService("CollectionService")
|
------------------------------------------------------------------------
--
-- * used in luaK:discharge2anyreg(), luaK:exp2reg()
------------------------------------------------------------------------
|
function luaK:discharge2reg(fs, e, reg)
self:dischargevars(fs, e)
local k = e.k
if k == "VNIL" then
self:_nil(fs, reg, 1)
elseif k == "VFALSE" or k == "VTRUE" then
self:codeABC(fs, "OP_LOADBOOL", reg, (e.k == "VTRUE") and 1 or 0, 0)
elseif k == "VK" then
self:codeABx(fs, "OP_LOADK", reg, e.info)
elseif k == "VKNUM" then
self:codeABx(fs, "OP_LOADK", reg, self:numberK(fs, e.nval))
elseif k == "VRELOCABLE" then
local pc = self:getcode(fs, e)
luaP:SETARG_A(pc, reg)
elseif k == "VNONRELOC" then
if reg ~= e.info then
self:codeABC(fs, "OP_MOVE", reg, e.info, 0)
end
else
assert(e.k == "VVOID" or e.k == "VJMP")
return -- nothing to do...
end
e.info = reg
e.k = "VNONRELOC"
end
|
--AzothxD Fog Script. :D
|
game.Lighting.FogStart = 10
game.Lighting.FogEnd = 60
game.Lighting.FogColor = Color3.new(0,0,0)
game.Lighting.TimeOfDay = "00:00"
|
--------------------
|
while true do
-- Every 15 seconds, poll if jeep has turned upside down. If true, then flip back upright.
if(vehicleSeatback.CFrame.lookVector.y <= 0.707) then
print("UFO is flipped. Flipping right side up...")
gyro.cframe = CFrame.new( Vector3.new(0,0,0), Vector3.new(0,1,0) )
gyro.maxTorque = Vector3.new(flipForce, flipForce, flipForce)
wait(2)
gyro.maxTorque = Vector3.new(0,0,0)
end
wait(8)
end
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["JestDiff"]["JestDiff"])
export type Diff = Package.Diff
export type DiffOptions = Package.DiffOptions
export type DiffOptionsColor = Package.DiffOptionsColor
return Package
|
--//Configure//--
|
EngineSound = "http://www.roblox.com/asset/?id=426479434"
enginevolume = 3
enginePitchAdjust = 1
IdleSound = "http://www.roblox.com/asset/?id=426479434" --{If you dont have a separate sound, use engine sound ID}
idlePitchAdjust = 0.9
TurboSound = "http://www.roblox.com/asset/?id=286070281"
turbovolume = 10
SuperchargerSound = "http://www.roblox.com/asset/?id=404779487"
superchargervolume = 10
HornSound = "http://www.roblox.com/asset/?id=143133249"
hornvolume = 4
StartupSound = "http://www.roblox.com/asset/?id=169394147"
startupvolume = 3
startuplength = 0 --{adjust this for a longer startup duration}
WHEELS_VISIBLE = false --If your wheels transparency is a problem, change this value to false
BRAKES_VISIBLE = false --This is to hide the realistic brakes, you can set this to false if you'd like to see how the brakes work
AUTO_FLIP = true --If false, your car will not flip itself back over in the event of a turnover
SpeedoReading = "KPH" --{KPH, MPH}
RevDecay = 150 --{The higher this value, the faster it will decay}
--//INSPARE//--
--//SS6//--
--//Build 1.0//--
--and i'll write your name.
script.Parent.Name = "VehicleSeat"
wait(0.1)
checker = Instance.new("Model")
checker.Name = "PGSCH"
checker.Parent = game.Workspace
checkertb = Instance.new("Part")
checkertb.Name = "Test"
checkertb.Parent = checker
checkertb.CanCollide = false
checkertb.TopSurface = Enum.SurfaceType.SmoothNoOutlines
checkertb.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
checkertb.Transparency = 0.8
checkertop = Instance.new("Part")
checkertop.Name = "Top"
checkertop.Parent = checker
checkertop.Anchored = true
checkertop.CanCollide = false
checkertop.TopSurface = Enum.SurfaceType.SmoothNoOutlines
checkertop.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
checkertop.Transparency = 0.8
checker1 = Instance.new("Attachment", checkertb)
checker2 = Instance.new("Attachment", checkertop)
checkerrope = Instance.new("RopeConstraint", checkertb)
checkerrope.Attachment0 = checker1
checkerrope.Attachment1 = checker2
checkerbf = Instance.new("BodyForce", checkertb)
checkerbf.Force = Vector3.new(0, -1000000, 0)
alertbbg = Instance.new("BillboardGui", script.Parent)
alertbbg.Size = UDim2.new(0, 500, 0, 100)
alertbbg.StudsOffset = Vector3.new(0,8,0)
alertbbg.AlwaysOnTop = true
alertbbg.Enabled = false
alerttext = Instance.new("TextLabel", alertbbg)
alerttext.BackgroundColor3 = Color3.new(97/255, 255/255, 176/255)
alerttext.BackgroundTransparency = 0.5
alerttext.TextSize = 24
alerttext.TextStrokeTransparency = 0.8
alerttext.Size = UDim2.new(1,0,1,0)
alerttext.BorderSizePixel = 0
alerttext.TextColor3 = Color3.new(1,1,1)
alerttext.TextWrapped = true
alerttext.Font = "SourceSans"
alerttext.Text = "PGSPhysicsSolver must be enabled to use this chassis! Enable this feature in the Workspace."
finesse = true
vr = 0
checker.ChildRemoved:connect(function(instance)
if finesse == true then
alertbbg.Enabled = true
vr = 1
end
end)
wait(0.35)
if vr == 0 then
finesse = false
checker:remove()
local PreS = script.Assets.PreSet:Clone()
PreS.Parent = script.Parent
PreS.Disabled = false
script.Parent:WaitForChild("PreSet")
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(math.rad(0.59), math.rad(0), math.rad(0))
if BRAKES_VISIBLE == true then
bv = 0
else
bv = 1
end
|
------------------------------------------------------------------------
--
-- * used only in (lparser) luaY:subexpr()
------------------------------------------------------------------------
-- table lookups to simplify testing
|
luaK.arith_op = {
OPR_ADD = "OP_ADD", OPR_SUB = "OP_SUB", OPR_MUL = "OP_MUL",
OPR_DIV = "OP_DIV", OPR_MOD = "OP_MOD", OPR_POW = "OP_POW",
}
luaK.comp_op = {
OPR_EQ = "OP_EQ", OPR_NE = "OP_EQ", OPR_LT = "OP_LT",
OPR_LE = "OP_LE", OPR_GT = "OP_LT", OPR_GE = "OP_LE",
}
luaK.comp_cond = {
OPR_EQ = 1, OPR_NE = 0, OPR_LT = 1,
OPR_LE = 1, OPR_GT = 0, OPR_GE = 0,
}
function luaK:posfix(fs, op, e1, e2)
-- needed because e1 = e2 doesn't copy values...
-- * in 5.0.x, only k/info/aux/t/f copied, t for AND, f for OR
-- but here, all elements are copied for completeness' sake
local function copyexp(e1, e2)
e1.k = e2.k
e1.info = e2.info; e1.aux = e2.aux
e1.nval = e2.nval
e1.t = e2.t; e1.f = e2.f
end
if op == "OPR_AND" then
assert(e1.t == self.NO_JUMP) -- list must be closed
self:dischargevars(fs, e2)
e2.f = self:concat(fs, e2.f, e1.f)
copyexp(e1, e2)
elseif op == "OPR_OR" then
assert(e1.f == self.NO_JUMP) -- list must be closed
self:dischargevars(fs, e2)
e2.t = self:concat(fs, e2.t, e1.t)
copyexp(e1, e2)
elseif op == "OPR_CONCAT" then
self:exp2val(fs, e2)
if e2.k == "VRELOCABLE" and luaP:GET_OPCODE(self:getcode(fs, e2)) == "OP_CONCAT" then
assert(e1.info == luaP:GETARG_B(self:getcode(fs, e2)) - 1)
self:freeexp(fs, e1)
luaP:SETARG_B(self:getcode(fs, e2), e1.info)
e1.k = "VRELOCABLE"
e1.info = e2.info
else
self:exp2nextreg(fs, e2) -- operand must be on the 'stack'
self:codearith(fs, "OP_CONCAT", e1, e2)
end
else
-- the following uses a table lookup in place of conditionals
local arith = self.arith_op[op]
if arith then
self:codearith(fs, arith, e1, e2)
else
local comp = self.comp_op[op]
if comp then
self:codecomp(fs, comp, self.comp_cond[op], e1, e2)
else
assert(0)
end
end--if arith
end--if op
end
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return plrData.Classes.Super.Viper.Obtained.Value == true
end
|
--[[ Local Constants ]]
|
--
wait(999999999999999999999)
local UNIT_Z = Vector3.new(0,0,1)
local X1_Y0_Z1 = Vector3.new(1,0,1) --Note: not a unit vector, used for projecting onto XZ plane
local THUMBSTICK_DEADZONE = 0.2
local DEFAULT_DISTANCE = 12.5 -- Studs
local PORTRAIT_DEFAULT_DISTANCE = 25 -- Studs
local FIRST_PERSON_DISTANCE_THRESHOLD = 1.0 -- Below this value, snap into first person
local CAMERA_ACTION_PRIORITY = Enum.ContextActionPriority.Default.Value
|
--[[
-- This is how u get module
local Short = require(game.ReplicatedStorage.Short)
-- This is how you shorten value (must be number)
Short.en(Input)
--]]
| |
--CHANGE THE NAME, COPY ALL BELOW, AND PAST INTO COMMAND BAR
|
local TycoonName = "Venom Tycoon"
if game.Workspace:FindFirstChild(TycoonName) then
local s = nil
local bTycoon = game.Workspace:FindFirstChild(TycoonName)
local zTycoon = game.Workspace:FindFirstChild("Zednov's Tycoon Kit")
local new_Collector = zTycoon['READ ME'].Script:Clone()
local Gate = zTycoon.Tycoons:GetChildren()[1].Entrance['Touch to claim!'].GateControl:Clone()
if zTycoon then
for i,v in pairs(zTycoon.Tycoons:GetChildren()) do --Wipe current tycoon 'demo'
if v then
s = v.PurchaseHandler:Clone()
v:Destroy()
end
end
-- Now make it compatiable
if s ~= nil then
for i,v in pairs(bTycoon.Tycoons:GetChildren()) do
local New_Tycoon = v:Clone()
New_Tycoon:FindFirstChild('PurchaseHandler'):Destroy()
s:Clone().Parent = New_Tycoon
local Team_C = Instance.new('BrickColorValue',New_Tycoon)
Team_C.Value = BrickColor.new(tostring(v.Name))
Team_C.Name = "TeamColor"
New_Tycoon.Name = v.TeamName.Value
New_Tycoon.Cash.Name = "CurrencyToCollect"
New_Tycoon.Parent = zTycoon.Tycoons
New_Tycoon.TeamName:Destroy()
v:Destroy()
New_Tycoon.Essentials:FindFirstChild('Cash to collect: $0').NameUpdater:Destroy()
local n = new_Collector:Clone()
n.Parent = New_Tycoon.Essentials:FindFirstChild('Cash to collect: $0')
n.Disabled = false
New_Tycoon.Gate['Touch to claim ownership!'].GateControl:Destroy()
local g = Gate:Clone()
g.Parent = New_Tycoon.Gate['Touch to claim ownership!']
end
else
error("Please don't tamper with script names or this won't work!")
end
else
error("Please don't change the name of our tycoon kit or it won't work!")
end
bTycoon:Destroy()
Gate:Destroy()
new_Collector:Destroy()
print('Transfer complete! :)')
else
error("Check if you spelt the kit's name wrong!")
end
|
--[=[
Retrieves group role info for a given rankId
@param groupId number
@param rankId number
@return Promise<table>
]=]
|
function GroupUtils.promiseGroupRoleInfo(groupId, rankId)
assert(groupId, "Bad groupId")
assert(rankId, "Bad rankId")
return GroupUtils.promiseGroupInfo(groupId)
:Then(function(groupInfo)
if type(groupInfo.Roles) ~= "table" then
return Promise.rejected("No Roles table")
end
for _, rankInfo in pairs(groupInfo.Roles) do
if rankInfo.Rank == rankId then
return rankInfo
end
end
return Promise.rejected("No rank with given id")
end)
end
return GroupUtils
|
--[[ Configuration ]]
|
local ShowPath = true
local PlayFailureAnimation = true
local UseDirectPath = false
local UseDirectPathForVehicle = true
local AgentSizeIncreaseFactor = 1.0
local UnreachableWaypointTimeout = 8
|
--[[ The Module ]]
|
--
local BaseCamera = require(script.Parent:WaitForChild("BaseCamera"))
local VRBaseCamera = setmetatable({}, BaseCamera)
VRBaseCamera.__index = VRBaseCamera
function VRBaseCamera.new()
local self = setmetatable(BaseCamera.new(), VRBaseCamera)
-- distance is different in VR
self.defaultDistance = VR_ZOOM
self.defaultSubjectDistance = math.clamp(self.defaultDistance, player.CameraMinZoomDistance, player.CameraMaxZoomDistance)
self.currentSubjectDistance = math.clamp(self.defaultDistance, player.CameraMinZoomDistance, player.CameraMaxZoomDistance)
-- VR screen effect
self.VRFadeResetTimer = 0
self.VREdgeBlurTimer = 0
-- initialize vr specific variables
self.gamepadResetConnection = nil
self.needsReset = true
return self
end
function VRBaseCamera:GetModuleName()
return "VRBaseCamera"
end
function VRBaseCamera:GamepadZoomPress()
local dist = self:GetCameraToSubjectDistance()
if dist > VR_ZOOM / 2 then
self:SetCameraToSubjectDistance(0)
self.currentSubjectDistance = 0
else
self:SetCameraToSubjectDistance(VR_ZOOM)
self.currentSubjectDistance = VR_ZOOM
end
self:GamepadReset()
self:ResetZoom()
end
function VRBaseCamera:GamepadReset()
self.needsReset = true
end
function VRBaseCamera:ResetZoom()
ZoomController.SetZoomParameters(self.currentSubjectDistance, 0)
ZoomController.ReleaseSpring()
end
function VRBaseCamera:OnEnable(enable: boolean)
if enable then
self.gamepadResetConnection = CameraInput.gamepadReset:Connect(function()
self:GamepadReset()
end)
else
-- make sure zoom is reset when switching to another camera
if self.inFirstPerson then
self:GamepadZoomPress()
end
if self.gamepadResetConnection then
self.gamepadResetConnection:Disconnect()
self.gamepadResetConnection = nil
end
-- reset VR effects
self.VREdgeBlurTimer = 0
self:UpdateEdgeBlur(player, 1)
local VRFade = Lighting:FindFirstChild("VRFade")
if VRFade then
VRFade.Brightness = 0
end
end
end
function VRBaseCamera:UpdateDefaultSubjectDistance()
self.defaultSubjectDistance = math.clamp(VR_ZOOM, player.CameraMinZoomDistance, player.CameraMaxZoomDistance)
end
|
-- Keyboard
-- Stephen Leitnick
-- October 10, 2021
|
local Trove = require(script.Parent.Parent.Trove)
local Signal = require(script.Parent.Parent.Signal)
local UserInputService = game:GetService("UserInputService")
|
--[[
Unpacks an animatable type into an array of numbers.
If the type is not animatable, an empty array will be returned.
]]
|
local Package = script.Parent.Parent
local Types = require(Package.Types)
local Oklab = require(Package.Colour.Oklab)
local function unpackType(value: Types.Animatable, typeString: string): {number}
if typeString == "number" then
return {value}
elseif typeString == "CFrame" then
-- FUTURE: is there a better way of doing this? doing distance
-- calculations on `angle` may be incorrect
local axis, angle = value:ToAxisAngle()
return {value.X, value.Y, value.Z, axis.X, axis.Y, axis.Z, angle}
elseif typeString == "Color3" then
local lab = Oklab.to(value)
return {lab.X, lab.Y, lab.Z}
elseif typeString == "ColorSequenceKeypoint" then
local lab = Oklab.to(value.Value)
return {lab.X, lab.Y, lab.Z, value.Time}
elseif typeString == "DateTime" then
return {value.UnixTimestampMillis}
elseif typeString == "NumberRange" then
return {value.Min, value.Max}
elseif typeString == "NumberSequenceKeypoint" then
return {value.Value, value.Time, value.Envelope}
elseif typeString == "PhysicalProperties" then
return {value.Density, value.Friction, value.Elasticity, value.FrictionWeight, value.ElasticityWeight}
elseif typeString == "Ray" then
return {value.Origin.X, value.Origin.Y, value.Origin.Z, value.Direction.X, value.Direction.Y, value.Direction.Z}
elseif typeString == "Rect" then
return {value.Min.X, value.Min.Y, value.Max.X, value.Max.Y}
elseif typeString == "Region3" then
-- FUTURE: support rotated Region3s if/when they become constructable
return {
value.CFrame.X, value.CFrame.Y, value.CFrame.Z,
value.Size.X, value.Size.Y, value.Size.Z
}
elseif typeString == "Region3int16" then
return {value.Min.X, value.Min.Y, value.Min.Z, value.Max.X, value.Max.Y, value.Max.Z}
elseif typeString == "UDim" then
return {value.Scale, value.Offset}
elseif typeString == "UDim2" then
return {value.X.Scale, value.X.Offset, value.Y.Scale, value.Y.Offset}
elseif typeString == "Vector2" then
return {value.X, value.Y}
elseif typeString == "Vector2int16" then
return {value.X, value.Y}
elseif typeString == "Vector3" then
return {value.X, value.Y, value.Z}
elseif typeString == "Vector3int16" then
return {value.X, value.Y, value.Z}
else
return {}
end
end
return unpackType
|
--[[ Module functions ]]
|
--
function Invisicam:LimbBehavior(castPoints)
for limb, _ in pairs(self.trackedLimbs) do
castPoints[#castPoints + 1] = limb.Position
end
end
function Invisicam:MoveBehavior(castPoints)
for i = 1, MOVE_CASTS do
local position: Vector3, velocity: Vector3 = self.humanoidRootPart.Position, self.humanoidRootPart.Velocity
local horizontalSpeed: number = Vector3.new(velocity.X, 0, velocity.Z).Magnitude / 2
local offsetVector: Vector3 = (i - 1) * self.humanoidRootPart.CFrame.lookVector :: Vector3 * horizontalSpeed
castPoints[#castPoints + 1] = position + offsetVector
end
end
function Invisicam:CornerBehavior(castPoints)
local cframe: CFrame = self.humanoidRootPart.CFrame
local centerPoint: Vector3 = cframe.Position
local rotation = cframe - centerPoint
local halfSize = self.char:GetExtentsSize() / 2 --NOTE: Doesn't update w/ limb animations
castPoints[#castPoints + 1] = centerPoint
for i = 1, #CORNER_FACTORS do
castPoints[#castPoints + 1] = centerPoint + (rotation * (halfSize * CORNER_FACTORS[i]))
end
end
function Invisicam:CircleBehavior(castPoints)
local cframe: CFrame
if self.mode == MODE.CIRCLE1 then
cframe = self.humanoidRootPart.CFrame
else
local camCFrame: CFrame = self.camera.CoordinateFrame
cframe = camCFrame - camCFrame.Position + self.humanoidRootPart.Position
end
castPoints[#castPoints + 1] = cframe.Position
for i = 0, CIRCLE_CASTS - 1 do
local angle = (2 * math.pi / CIRCLE_CASTS) * i
local offset = 3 * Vector3.new(math.cos(angle), math.sin(angle), 0)
castPoints[#castPoints + 1] = cframe * offset
end
end
function Invisicam:LimbMoveBehavior(castPoints)
self:LimbBehavior(castPoints)
self:MoveBehavior(castPoints)
end
function Invisicam:CharacterOutlineBehavior(castPoints)
local torsoUp = self.torsoPart.CFrame.upVector.unit
local torsoRight = self.torsoPart.CFrame.rightVector.unit
-- Torso cross of points for interior coverage
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p + torsoUp
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p - torsoUp
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p + torsoRight
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p - torsoRight
if self.headPart then
castPoints[#castPoints + 1] = self.headPart.CFrame.p
end
local cframe = CFrame.new(ZERO_VECTOR3,Vector3.new(self.camera.CoordinateFrame.lookVector.X,0,self.camera.CoordinateFrame.lookVector.Z))
local centerPoint = (self.torsoPart and self.torsoPart.Position or self.humanoidRootPart.Position)
local partsWhitelist = {self.torsoPart}
if self.headPart then
partsWhitelist[#partsWhitelist + 1] = self.headPart
end
for i = 1, CHAR_OUTLINE_CASTS do
local angle = (2 * math.pi * i / CHAR_OUTLINE_CASTS)
local offset = cframe * (3 * Vector3.new(math.cos(angle), math.sin(angle), 0))
offset = Vector3.new(offset.X, math.max(offset.Y, -2.25), offset.Z)
local ray = Ray.new(centerPoint + offset, -3 * offset)
local hit, hitPoint = game.Workspace:FindPartOnRayWithWhitelist(ray, partsWhitelist, false, false)
if hit then
-- Use hit point as the cast point, but nudge it slightly inside the character so that bumping up against
-- walls is less likely to cause a transparency glitch
castPoints[#castPoints + 1] = hitPoint + 0.2 * (centerPoint - hitPoint).unit
end
end
end
function Invisicam:SmartCircleBehavior(castPoints)
local torsoUp = self.torsoPart.CFrame.upVector.unit
local torsoRight = self.torsoPart.CFrame.rightVector.unit
-- SMART_CIRCLE mode includes rays to head and 5 to the torso.
-- Hands, arms, legs and feet are not included since they
-- are not canCollide and can therefore go inside of parts
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p + torsoUp
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p - torsoUp
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p + torsoRight
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p - torsoRight
if self.headPart then
castPoints[#castPoints + 1] = self.headPart.CFrame.p
end
local cameraOrientation = self.camera.CFrame - self.camera.CFrame.p
local torsoPoint = Vector3.new(0,0.5,0) + (self.torsoPart and self.torsoPart.Position or self.humanoidRootPart.Position)
local radius = 2.5
-- This loop first calculates points in a circle of radius 2.5 around the torso of the character, in the
-- plane orthogonal to the camera's lookVector. Each point is then raycast to, to determine if it is within
-- the free space surrounding the player (not inside anything). Two iterations are done to adjust points that
-- are inside parts, to try to move them to valid locations that are still on their camera ray, so that the
-- circle remains circular from the camera's perspective, but does not cast rays into walls or parts that are
-- behind, below or beside the character and not really obstructing view of the character. This minimizes
-- the undesirable situation where the character walks up to an exterior wall and it is made invisible even
-- though it is behind the character.
for i = 1, SMART_CIRCLE_CASTS do
local angle = SMART_CIRCLE_INCREMENT * i - 0.5 * math.pi
local offset = radius * Vector3.new(math.cos(angle), math.sin(angle), 0)
local circlePoint = torsoPoint + cameraOrientation * offset
-- Vector from camera to point on the circle being tested
local vp = circlePoint - self.camera.CFrame.p
local ray = Ray.new(torsoPoint, circlePoint - torsoPoint)
local hit, hp, hitNormal = game.Workspace:FindPartOnRayWithIgnoreList(ray, {self.char}, false, false )
local castPoint = circlePoint
if hit then
local hprime = hp + 0.1 * hitNormal.unit -- Slightly offset hit point from the hit surface
local v0 = hprime - torsoPoint -- Vector from torso to offset hit point
local perp = (v0:Cross(vp)).unit
-- Vector from the offset hit point, along the hit surface
local v1 = (perp:Cross(hitNormal)).unit
-- Vector from camera to offset hit
local vprime = (hprime - self.camera.CFrame.p).unit
-- This dot product checks to see if the vector along the hit surface would hit the correct
-- side of the invisicam cone, or if it would cross the camera look vector and hit the wrong side
if ( v0.unit:Dot(-v1) < v0.unit:Dot(vprime)) then
castPoint = RayIntersection(hprime, v1, circlePoint, vp)
if castPoint.Magnitude > 0 then
local ray = Ray.new(hprime, castPoint - hprime)
local hit, hitPoint, hitNormal = game.Workspace:FindPartOnRayWithIgnoreList(ray, {self.char}, false, false )
if hit then
local hprime2 = hitPoint + 0.1 * hitNormal.unit
castPoint = hprime2
end
else
castPoint = hprime
end
else
castPoint = hprime
end
local ray = Ray.new(torsoPoint, (castPoint - torsoPoint))
local hit, hitPoint, hitNormal = game.Workspace:FindPartOnRayWithIgnoreList(ray, {self.char}, false, false )
if hit then
local castPoint2 = hitPoint - 0.1 * (castPoint - torsoPoint).unit
castPoint = castPoint2
end
end
castPoints[#castPoints + 1] = castPoint
end
end
function Invisicam:CheckTorsoReference()
if self.char then
self.torsoPart = self.char:FindFirstChild("Torso")
if not self.torsoPart then
self.torsoPart = self.char:FindFirstChild("UpperTorso")
if not self.torsoPart then
self.torsoPart = self.char:FindFirstChild("HumanoidRootPart")
end
end
self.headPart = self.char:FindFirstChild("Head")
end
end
function Invisicam:CharacterAdded(char: Model, player: Player)
-- We only want the LocalPlayer's character
if player~=PlayersService.LocalPlayer then return end
if self.childAddedConn then
self.childAddedConn:Disconnect()
self.childAddedConn = nil
end
if self.childRemovedConn then
self.childRemovedConn:Disconnect()
self.childRemovedConn = nil
end
self.char = char
self.trackedLimbs = {}
local function childAdded(child)
if child:IsA("BasePart") then
if LIMB_TRACKING_SET[child.Name] then
self.trackedLimbs[child] = true
end
if child.Name == "Torso" or child.Name == "UpperTorso" then
self.torsoPart = child
end
if child.Name == "Head" then
self.headPart = child
end
end
end
local function childRemoved(child)
self.trackedLimbs[child] = nil
-- If removed/replaced part is 'Torso' or 'UpperTorso' double check that we still have a TorsoPart to use
self:CheckTorsoReference()
end
self.childAddedConn = char.ChildAdded:Connect(childAdded)
self.childRemovedConn = char.ChildRemoved:Connect(childRemoved)
for _, child in pairs(self.char:GetChildren()) do
childAdded(child)
end
end
function Invisicam:SetMode(newMode: number)
AssertTypes(newMode, 'number')
for _, modeNum in pairs(MODE) do
if modeNum == newMode then
self.mode = newMode
self.behaviorFunction = self.behaviors[self.mode]
return
end
end
error("Invalid mode number")
end
function Invisicam:GetObscuredParts()
return self.savedHits
end
|
-- Define the function to toggle the frames and button position
|
local function toggleFrames()
if frame1.Visible == true and apl.Value == true then
-- If frames are visible, hide them and tween button to closed position
frame1.Closed.Visible = true
game:GetService("TweenService"):Create(frame1.Closed, TweenInfo.new(0.2), {BackgroundTransparency = 0}):Play()
wait(0.2)
frame1.Visible = false
sud:Play()
textButton.Text = ">"
elseif frame1.Visible == false and apl.Value == true then
-- If frames are hidden, show them and tween button to open position
frame1.Visible = true
game:GetService("TweenService"):Create(frame1.Closed, TweenInfo.new(0.2), {BackgroundTransparency = 1}):Play()
wait(0.2)
frame1.Closed.Visible = false
sud:Play()
textButton.Text = "<"
end
end
|
--[[
GrenadeExplosion
Description: This simple script creates the explosion which kills the players
]]
| |
--[[
Calls a callback on `andThen` with specific arguments.
]]
|
function Promise.prototype:andThenCall(callback, ...)
assert(type(callback) == "function", string.format(ERROR_NON_FUNCTION, "Promise:andThenCall"))
local length, values = pack(...)
return self:_andThen(debug.traceback(nil, 2), function()
return callback(unpack(values, 1, length))
end)
end
Promise.prototype.AndThenCall = Promise.prototype.andThenCall
Promise.prototype.ThenCall = Promise.prototype.andThenCall
|
--[[
A dictionary of primary and secondary colors associated with Item Categories.
Used to determine the colors a given item's ListItems should have in a ListSelector
--]]
|
local ItemCategory = require(script.Parent.ItemCategory)
local ColorTheme = require(script.Parent.ColorTheme)
type CategoryColorSchemeType = {
Primary: Color3,
Secondary: Color3,
}
type ItemCategoryColorsType = {
[ItemCategory.EnumType]: CategoryColorSchemeType,
}
local ItemCategoryColor: ItemCategoryColorsType = {
[ItemCategory.Plants] = {
Primary = ColorTheme.Green,
Secondary = ColorTheme.LightGreen,
},
[ItemCategory.Seeds] = {
Primary = ColorTheme.Green,
Secondary = ColorTheme.LightGreen,
},
[ItemCategory.Pots] = {
Primary = ColorTheme.Orange,
Secondary = ColorTheme.LightOrange,
},
[ItemCategory.Tables] = {
Primary = ColorTheme.Orange,
Secondary = ColorTheme.LightOrange,
},
[ItemCategory.Wagons] = {
Primary = ColorTheme.Orange,
Secondary = ColorTheme.LightOrange,
},
[ItemCategory.CoinBundles] = {
Primary = ColorTheme.Orange,
Secondary = ColorTheme.LightOrange,
},
}
return ItemCategoryColor
|
-- Container for temporary connections (disconnected automatically)
|
local Connections = {};
function ResizeTool.Equip()
-- Enables the tool's equipped functionality
-- Start up our interface
ShowUI();
ShowHandles();
BindShortcutKeys();
end;
function ResizeTool.Unequip()
-- Disables the tool's equipped functionality
-- Clear unnecessary resources
HideUI();
HideHandles();
ClearConnections();
SnapTracking.StopTracking();
FinishSnapping();
end;
function ClearConnections()
-- Clears out temporary connections
for ConnectionKey, Connection in pairs(Connections) do
Connection:Disconnect();
Connections[ConnectionKey] = nil;
end;
end;
function ClearConnection(ConnectionKey)
-- Clears the given specific connection
local Connection = Connections[ConnectionKey];
-- Disconnect the connection if it exists
if Connection then
Connection:Disconnect();
Connections[ConnectionKey] = nil;
end;
end;
function ShowUI()
-- Creates and reveals the UI
-- Reveal UI if already created
if ResizeTool.UI then
-- Reveal the UI
ResizeTool.UI.Visible = true;
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
-- Skip UI creation
return;
end;
-- Create the UI
ResizeTool.UI = Core.Tool.Interfaces.BTResizeToolGUI:Clone();
ResizeTool.UI.Parent = Core.UI;
ResizeTool.UI.Visible = true;
-- Add functionality to the directions option switch
local DirectionsSwitch = ResizeTool.UI.DirectionsOption;
DirectionsSwitch.Normal.Button.MouseButton1Down:Connect(function ()
SetDirections('Normal');
end);
DirectionsSwitch.Both.Button.MouseButton1Down:Connect(function ()
SetDirections('Both');
end);
-- Add functionality to the increment input
local IncrementInput = ResizeTool.UI.IncrementOption.Increment.TextBox;
IncrementInput.FocusLost:Connect(function (EnterPressed)
ResizeTool.Increment = tonumber(IncrementInput.Text) or ResizeTool.Increment;
IncrementInput.Text = Support.Round(ResizeTool.Increment, 4);
end);
-- Add functionality to the size inputs
local XInput = ResizeTool.UI.Info.SizeInfo.X.TextBox;
local YInput = ResizeTool.UI.Info.SizeInfo.Y.TextBox;
local ZInput = ResizeTool.UI.Info.SizeInfo.Z.TextBox;
XInput.FocusLost:Connect(function (EnterPressed)
local NewSize = tonumber(XInput.Text);
if NewSize then
SetAxisSize('X', NewSize);
end;
end);
YInput.FocusLost:Connect(function (EnterPressed)
local NewSize = tonumber(YInput.Text);
if NewSize then
SetAxisSize('Y', NewSize);
end;
end);
ZInput.FocusLost:Connect(function (EnterPressed)
local NewSize = tonumber(ZInput.Text);
if NewSize then
SetAxisSize('Z', NewSize);
end;
end);
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
end;
function HideUI()
-- Hides the tool UI
-- Make sure there's a UI
if not ResizeTool.UI then
return;
end;
-- Hide the UI
ResizeTool.UI.Visible = false;
-- Stop updating the UI
UIUpdater:Stop();
end;
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not ResizeTool.UI then
return;
end;
-- Only show and calculate selection info if it's not empty
if #Selection.Parts == 0 then
ResizeTool.UI.Info.Visible = false;
ResizeTool.UI.Size = UDim2.new(0, 245, 0, 90);
return;
else
ResizeTool.UI.Info.Visible = true;
ResizeTool.UI.Size = UDim2.new(0, 245, 0, 150);
end;
-----------------------------------------
-- Update the size information indicators
-----------------------------------------
-- Identify common sizes across axes
local XVariations, YVariations, ZVariations = {}, {}, {};
for _, Part in pairs(Selection.Parts) do
table.insert(XVariations, Support.Round(Part.Size.X, 3));
table.insert(YVariations, Support.Round(Part.Size.Y, 3));
table.insert(ZVariations, Support.Round(Part.Size.Z, 3));
end;
local CommonX = Support.IdentifyCommonItem(XVariations);
local CommonY = Support.IdentifyCommonItem(YVariations);
local CommonZ = Support.IdentifyCommonItem(ZVariations);
-- Shortcuts to indicators
local XIndicator = ResizeTool.UI.Info.SizeInfo.X.TextBox;
local YIndicator = ResizeTool.UI.Info.SizeInfo.Y.TextBox;
local ZIndicator = ResizeTool.UI.Info.SizeInfo.Z.TextBox;
-- Update each indicator if it's not currently being edited
if not XIndicator:IsFocused() then
XIndicator.Text = CommonX or '*';
end;
if not YIndicator:IsFocused() then
YIndicator.Text = CommonY or '*';
end;
if not ZIndicator:IsFocused() then
ZIndicator.Text = CommonZ or '*';
end;
end;
function SetDirections(DirectionMode)
-- Sets the given resizing direction mode
-- Update setting
ResizeTool.Directions = DirectionMode;
-- Update the UI switch
if ResizeTool.UI then
Core.ToggleSwitch(DirectionMode, ResizeTool.UI.DirectionsOption);
end;
end;
|
--TUNE
|
local SpeedType = "MPH" -- MPH or KPH
local car = script.Parent.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local Values = script.Parent.Parent.Values
local KPH = (10/12) * 1.09728
local MPH = (10/12) * (60/88)
local speed = 0
local Boost = _Tune.Boost
local Red = 0
local smooth = 0.9
local TBsmooth = 0.8
if _Tune.Redline >= 7000 then
Red = 8000
script.Parent.RPM.ImageLabel.Image = "rbxassetid://1725902209"
end
if _Tune.Redline >= 8000 then
Red = 9000
script.Parent.RPM.ImageLabel.Image = "rbxassetid://1744323208"
end
if _Tune.Redline >= 9000 then
Red = 10000
script.Parent.RPM.ImageLabel.Image = "rbxassetid://1744323830"
end
if _Tune.Redline >= 10000 then
Red = 13000
script.Parent.RPM.ImageLabel.Image = "rbxassetid://1744324588"
end
script.Parent:WaitForChild("KphMph")
if SpeedType == "KPH" then
speed = KPH
script.Parent.KphMph.Text = "KPH"
end
if SpeedType == "MPH" then
speed = MPH
script.Parent.KphMph.Text = "MPH"
end
game["Run Service"].Stepped:connect(function()
script.Parent.Speed.Text = math.floor(Values.Velocity.Value.Magnitude*speed)
script.Parent.RPM.Needle.Rotation = script.Parent.RPM.Needle.Rotation*smooth + (-120 + ((Values.RPM.Value/Red)*240))*(1-smooth)
if Values.Gear.Value == -1 then
script.Parent.Gear.Image = "rbxassetid://1744318192"
end
if Values.Gear.Value == 0 then
script.Parent.Gear.Image = "rbxassetid://1744318493"
end
if Values.Gear.Value == 1 then
script.Parent.Gear.Image = "rbxassetid://1725900239"
end
if Values.Gear.Value == 2 then
script.Parent.Gear.Image = "rbxassetid://1725900573"
end
if Values.Gear.Value == 3 then
script.Parent.Gear.Image = "rbxassetid://1725900921"
end
if Values.Gear.Value == 4 then
script.Parent.Gear.Image = "rbxassetid://1725901197"
end
if Values.Gear.Value == 5 then
script.Parent.Gear.Image = "rbxassetid://1725901418"
end
if Values.Gear.Value == 6 then
script.Parent.Gear.Image = "rbxassetid://1725901667"
end
local direction = car.Wheels.FR.Base.CFrame:vectorToObjectSpace(car.Wheels.FR.Arm.CFrame.lookVector)
local direction2 = car.Wheels.FL.Base.CFrame:vectorToObjectSpace(car.Wheels.FL.Arm.CFrame.lookVector)
local angle = ((math.atan2(-direction.Z, direction.X))+(math.atan2(-direction2.Z, direction2.X)))/2
local anglez = (angle-1.57)*6
local r1 = Ray.new(car.Wheels.RL.Position,(car.Wheels.RL.Arm.CFrame*CFrame.Angles(-math.pi/2,0,0)).lookVector*(.05+car.Wheels.RL.Size.x/2))
local r1hit = 0
if workspace:FindPartOnRay(r1,car)~=nil then r1hit=1 end
local r2 = Ray.new(car.Wheels.RL.Position,(car.Wheels.RR.Arm.CFrame*CFrame.Angles(-math.pi/2,0,0)).lookVector*(.05+car.Wheels.RR.Size.x/2))
local r2hit = 0
if workspace:FindPartOnRay(r2,car)~=nil then r2hit=1 end
local rl = math.min((math.max(math.abs((car.Wheels.RL.RotVelocity.Magnitude*car.Wheels.RL.Size.x/2) - (car.Wheels.RL.Velocity.Magnitude))-30,0)),50)*r1hit
local rr = math.min((math.max(math.abs((car.Wheels.RR.RotVelocity.Magnitude*car.Wheels.RR.Size.x/2) - (car.Wheels.RR.Velocity.Magnitude))-30,0)),50)*r2hit
if rl >= 0.000001 and rr >= 0.000001 and anglez > 1 and Values.Velocity.Value.Magnitude > 15 or rl >= 0.000001 and rr >= 0.000001 and anglez < -1 and Values.Velocity.Value.Magnitude > 15 then
script.Parent.Drift.Image = "rbxassetid://1725900002"
else
script.Parent.Drift.Image = "rbxassetid://1725899752"
end
--TCS and ABS
if _Tune.TCSEnabled == true then
script.Parent.TCS.Visible = true
if script.Parent.Parent.Values.TCS.Value == true then
script.Parent.TCS.TextColor3 = Color3.new(1,1,1)
else
if script.Parent.Parent.Values.TCSActive.Value == true then
script.Parent.TCS.TextColor3 = Color3.new(1,1,0)
else
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
end
end
else
script.Parent.TCS.Visible = false
end
if _Tune.ABSEnabled == true then
script.Parent.ABS.Visible = true
if script.Parent.Parent.Values.ABS.Value == true then
script.Parent.ABS.TextColor3 = Color3.new(1,1,1)
else
if script.Parent.Parent.Values.ABSActive.Value == true then
script.Parent.ABS.TextColor3 = Color3.new(1,1,0)
else
script.Parent.ABS.TextColor3 = Color3.new(1,0,0)
end
end
else
script.Parent.ABS.Visible = false
end
--boost
script.Parent.Boost.Needle.Rotation = script.Parent.Boost.Needle.Rotation*smooth + (-110 + ((Values.Boost.Value/15)*90)+((Values.Boost.Value/Boost)*20))*(1-smooth)
if _Tune.Aspiration == "Natural" then
script.Parent.Boost.Visible = false
else
script.Parent.Boost.Visible = true
end
-- Throttle and Brake
script.Parent.Throttle.Rotation = script.Parent.Throttle.Rotation*TBsmooth + (script.Parent.Parent.Values.Throttle.Value*130)*(1-TBsmooth)
script.Parent.Brake.Rotation = script.Parent.Brake.Rotation*TBsmooth + (script.Parent.Parent.Values.Brake.Value*130)*(1-TBsmooth)
end)
|
--local ClickerModule = require(343254562)
--local clickEvent = ClickerModule.RemoteEvent
|
local interactiveParts = {}
local activationDistance = 12
local flushing = false
local water = script.Parent.Parent.Water
local sound = script.Parent.Parent.ToiletBowl.Sound
sound:Play()
wait(0.65)
for i, v in pairs(script.Parent.Parent:GetChildren()) do
if v.Name == "WaterSwirl" then
v.ParticleEmitter.Transparency = NumberSequence.new(0.9)
v.ParticleEmitter.Rate = 40
end
end
for i = 1, 4 do
water.CFrame = water.CFrame * CFrame.new(0, 0.01, 0)
wait()
end
for i = 1, 22 do
water.Mesh.Scale = water.Mesh.Scale + Vector3.new(-0.02, 0, -0.02)
water.CFrame = water.CFrame * CFrame.new(0, -0.015, 0)
wait()
end
if script.Parent.Parent.ToiletUsed.Value == true then
water.BrickColor = BrickColor.new("Pastel yellow")
end
wait(1.55)
for i = 1, 10 do
for ii, v in pairs(script.Parent.Parent:GetChildren()) do
if v.Name == "WaterSwirl" then
v.ParticleEmitter.Transparency = NumberSequence.new(0.9 + (0.015 * i))
if i == 10 then
v.ParticleEmitter.Rate = 0
end
end
end
wait(0.2)
end
script.Parent.Parent.ToiletUsed.Value = false
water.BrickColor = BrickColor.new("Fog")
for i = 1, 66 do
water.Mesh.Scale = water.Mesh.Scale + Vector3.new(0.0066, 0, 0.0066)
water.CFrame = water.CFrame * CFrame.new(0, 0.00409, 0)
wait()
end
water.CFrame = script.Parent.Parent.WaterResetPos.CFrame
water.Mesh.Scale = Vector3.new(1,0,1)
flushing = false
script.Disabled = true
|
-- Local private variables and constants
|
local UNIT_X = Vector3.new(1,0,0)
local UNIT_Y = Vector3.new(0,1,0)
local UNIT_Z = Vector3.new(0,0,1)
local X1_Y0_Z1 = Vector3.new(1,0,1) --Note: not a unit vector, used for projecting onto XZ plane
local ZERO_VECTOR3 = Vector3.new(0,0,0)
local ZERO_VECTOR2 = Vector2.new(0,0)
local VR_PITCH_FRACTION = 0.25
local tweenAcceleration = math.rad(220) --Radians/Second^2
local tweenSpeed = math.rad(0) --Radians/Second
local tweenMaxSpeed = math.rad(250) --Radians/Second
local TIME_BEFORE_AUTO_ROTATE = 2.0 --Seconds, used when auto-aligning camera with vehicles
local PORTRAIT_OFFSET = Vector3.new(0,-3,0)
local Util = require(script.Parent:WaitForChild("CameraUtils"))
|
--[=[
Same as [RxBrioUtils.where]. Here to keep backwards compatability.
@deprecated 3.6.0 -- This method does not wrap the resulting value in a Brio, which can sometimes lead to leaks.
@function filter
@param predicate (T) -> boolean
@return (source: Observable<Brio<T>>) -> Observable<Brio<T>>
@within RxBrioUtils
]=]
|
RxBrioUtils.filter = RxBrioUtils.where
|
--Power Rear Wheels
|
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="RL" or v.Name=="RR" or v.Name=="R" then
table.insert(Drive,v)
end
end
end
|
--// [[ INTRO CHANGELOG HOVER ]] \\--
|
IntroGui.ButtonFrame.ChangelogButton.MouseEnter:Connect(function()
IntroGui.ButtonFrame.ChangelogButton.GreenDot.Visible = true
end)
IntroGui.ButtonFrame.ChangelogButton.MouseLeave:Connect(function()
IntroGui.ButtonFrame.ChangelogButton.GreenDot.Visible = false
end)
|
--[=[
@param value any
@return any
Deserializes the given value.
]=]
|
function Ser.Deserialize(value: any): any
if type(value) == "table" then
local ser = Ser.Classes[value.ClassName]
if ser then
value = ser.Deserialize(value)
end
end
return value
end
|
--[[ this imanol
local stabygyro = Instance.new("BodyGyro",weightB)
stabygyro.D = 50
stabygyro.MaxTorque = Vector3.new(50,0,0)
stabygyro.P = 50
]]
| |
---
|
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.MouseButton1Click:connect(function()
if car.Misc.Popups.Parts.L.L.L.Enabled == false and car.Body.Lights.H.L.L.Enabled == false then
script.Parent.BackgroundColor3 = Color3.new(0,255/255,0)
script.Parent.TextStrokeColor3 = Color3.new(0,255/255,0)
car.Misc.Popups.Parts.L.L.L.Enabled = true
car.Body.Lights.R.L.L.Enabled = true
car.Body.Lights.H.L.L.Enabled = false
for index, child in pairs(car.Body.Lights.L:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Misc.Popups.Parts.L:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Body.Lights.R:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Body.Lights.H:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
elseif car.Misc.Popups.Parts.L.L.L.Enabled == true and car.Body.Lights.H.L.L.Enabled == false then
script.Parent.BackgroundColor3 = Color3.new(0,0,255/255)
script.Parent.TextStrokeColor3 = Color3.new(0,0,255/255)
car.Misc.Popups.Parts.L.L.L.Enabled = true
car.Body.Lights.R.L.L.Enabled = true
car.Body.Lights.H.L.L.Enabled = true
for index, child in pairs(car.Body.Lights.L:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Misc.Popups.Parts.L:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Body.Lights.R:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Body.Lights.H:GetChildren()) do
child.Material = Enum.Material.Neon
end
elseif car.Misc.Popups.Parts.L.L.L.Enabled == true and car.Body.Lights.H.L.L.Enabled == true then
script.Parent.BackgroundColor3 = Color3.new(0,0,0)
script.Parent.TextStrokeColor3 = Color3.new(0,0,0)
car.Misc.Popups.Parts.L.L.L.Enabled = false
car.Body.Lights.R.L.L.Enabled = false
car.Body.Lights.H.L.L.Enabled = false
for index, child in pairs(car.Body.Lights.L:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
for index, child in pairs(car.Misc.Popups.Parts.L:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
for index, child in pairs(car.Body.Lights.R:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
for index, child in pairs(car.Body.Lights.H:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
end
end)
script.Parent.Parent.Parent.Values.Brake.Changed:connect(function()
if script.Parent.Parent.Parent.Values.Brake.Value ~= 1 and script.Parent.Parent.Parent.IsOn.Value then
for index, child in pairs(car.Body.Lights.B:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
car.Body.Lights.B.L.L.Enabled = false
else
for index, child in pairs(car.Body.Lights.B:GetChildren()) do
child.Material = Enum.Material.Neon
end
car.Body.Lights.B.L.L.Enabled = true
end
end)
script.Parent.Parent.Parent.Values.Brake.Changed:connect(function()
if script.Parent.Parent.Parent.Values.Brake.Value ~= 1 then
for index, child in pairs(car.Body.Lights.B:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
car.Body.Lights.B.L.L.Enabled = false
else
for index, child in pairs(car.Body.Lights.B:GetChildren()) do
child.Material = Enum.Material.Neon
end
car.Body.Lights.B.L.L.Enabled = true
end
end)
script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()
if script.Parent.Parent.Parent.Values.Gear.Value == -1 then
for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
child.Material = Enum.Material.Neon
car.DriveSeat.Reverse:Play()
end
else
for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
car.DriveSeat.Reverse:Stop()
end
end
end)
while wait() do
if (car.DriveSeat.Velocity.magnitude/40)+0.300 < 1.3 then
car.DriveSeat.Reverse.Pitch = (car.DriveSeat.Velocity.magnitude/40)+0.300
car.DriveSeat.Reverse.Volume = (car.DriveSeat.Velocity.magnitude/150)
else
car.DriveSeat.Reverse.Pitch = 1.3
car.DriveSeat.Reverse.Volume = .2
end
end
|
-- Services
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local ServerStorage = game:GetService("ServerStorage")
local Players = game:GetService("Players")
|
--variables
|
local tiles = script.Parent:GetChildren() --tiles/items inside of the model
local speed = 3 --time between each color change
|
-- Initialize paint tool
|
local PaintTool = require(CoreTools:WaitForChild 'Paint')
Core.AssignHotkey('V', Core.Support.Call(Core.EquipTool, PaintTool));
Core.Dock.AddToolButton(Core.Assets.PaintIcon, 'V', PaintTool, 'PaintInfo');
|
--// All global vars will be wiped/replaced except script
|
return function(data, env)
if env then
setfenv(1, env)
end
--local client = service.GarbleTable(client)
local Player = service.Players.LocalPlayer
local Mouse = Player:GetMouse()
local InputService = service.UserInputService
local gIndex = data.gIndex
local gTable = data.gTable
local Event = gTable.BindEvent
local GUI = gTable.Object
local Name = data.Name
local Icon = data.Icon
local Size = data.Size
local Menu = data.Menu
local Title = data.Title
local Ready = data.Ready
local Walls = data.Walls
local noHide = data.NoHide
local noClose = data.NoClose
local onReady = data.OnReady
local onClose = data.OnClose
local onResize = data.OnResize
local onRefresh = data.OnRefresh
local onMinimize = data.OnMinimize
local ContextMenu = data.ContextMenu
local ResetOnSpawn = data.ResetOnSpawn
local CanKeepAlive = data.CanKeepAlive
local iconClicked = data.IconClicked
local SizeLocked = data.SizeLocked or data.SizeLock
local CanvasSize = data.CanvasSize
local Position = data.Position
local Content = data.Content or data.Children
local MinSize = data.MinSize or {150, 50}
local MaxSize = data.MaxSize or {math.huge, math.huge}
local curIcon = Mouse.Icon
local isClosed = false
local Resizing = false
local Refreshing = false
local DragEnabled = true
local checkProperty = service.CheckProperty
local specialInsts = {}
local inExpandable
local addTitleButton
local LoadChildren
local BringToFront
local functionify
local Drag = GUI.Drag
local Close = Drag.Close
local Hide = Drag.Hide
local Iconf = Drag.Icon
local Titlef = Drag.Title
local Refresh = Drag.Refresh
local rSpinner = Refresh.Spinner
local Main = Drag.Main
local Tooltip = GUI.Desc
local ScrollFrame = GUI.Drag.Main.ScrollingFrame
local LeftSizeIcon = Main.LeftResizeIcon
local RightSizeIcon = Main.RightResizeIcon
local RightCorner = Main.RightCorner
local LeftCorner = Main.LeftCorner
local RightSide = Main.RightSide
local LeftSide = Main.LeftSide
local TopRight = Main.TopRight
local TopLeft = Main.TopLeft
local Bottom = Main.Bottom
local Top = Main.Top
function Expand(ent, point, text, richText)
local label = point:FindFirstChild("Label")
if label then
ent.MouseLeave:Connect(function(x,y)
if inExpandable == ent then
point.Visible = false
end
end)
ent.MouseMoved:Connect(function(x,y)
inExpandable = ent
local text = text or ent.Desc.Value
label.Text = text
label.RichText = richText
label.TextScaled = richText
local sizeText = label.ContentText
local maxWidth = 400
local bounds = service.TextService:GetTextSize(sizeText, label.TextSize, label.Font, Vector2.new(maxWidth, math.huge))
local sizeX, sizeY = bounds.X + 10, bounds.Y + 10
local posX = (x + 6 + sizeX) < GUI.AbsoluteSize.X and (x + 6) or (x - 6 - sizeX)
local posY = (y - 6 - sizeY) > 0 and (y - 6 - sizeY) or (y)
point.Size = UDim2.fromOffset(sizeX, sizeY)
point.Position = UDim2.fromOffset(posX, posY)
point.Visible = true
end)
end
end
function getNextPos(frame)
local farXChild, farYChild
for i,v in ipairs(frame:GetChildren()) do
if checkProperty(v, "Size") then
if not farXChild or (v.AbsolutePosition.X + v.AbsoluteSize.X) > (farXChild.AbsolutePosition.X + farXChild.AbsoluteSize.X) then
farXChild = v
end
if not farYChild or (v.AbsolutePosition.Y + v.AbsoluteSize.Y) > (farXChild.AbsolutePosition.Y + farXChild.AbsoluteSize.Y) then
farYChild = v
end
end
end
return ((not farXChild or not farYChild) and UDim2.new(0,0,0,0)) or UDim2.new(farXChild.Position.X.Scale, farXChild.Position.X.Offset + farXChild.AbsoluteSize.X, farYChild.Position.Y.Scale, farYChild.Position.Y.Offset + farYChild.AbsoluteSize.Y)
end
function LoadChildren(Obj, Children)
if Children then
local runWhenDone = Children.RunWhenDone and functionify(Children.RunWhenDone, Obj)
for class,data in pairs(Children) do
if type(data) == "table" then
if not data.Parent then data.Parent = Obj end
create(data.Class or data.ClassName or class, data)
elseif type(data) == "function" or type(data) == "string" and not runWhenDone then
runWhenDone = functionify(data, Obj)
end
end
if runWhenDone then
runWhenDone(Obj)
end
end
end
function BringToFront()
for i,v in ipairs(Player.PlayerGui:GetChildren()) do
if v:FindFirstChild("__ADONIS_WINDOW") then
v.DisplayOrder = 100
end
end
GUI.DisplayOrder = 101
end
function addTitleButton(data)
local startPos = 1
local realPos
local new
local original = Hide
local diff = (Hide.AbsolutePosition.X + Hide.AbsoluteSize.X) - Close.AbsolutePosition.X;
local far = Close;
for i,obj in ipairs(Drag:GetChildren()) do
if obj:IsA("TextButton") then
if obj.Visible and obj.AbsolutePosition.X < far.AbsolutePosition.X then
far = obj;
end
end
end;
local size = data.Size or original.Size;
local xPos = far.Position.X.Offset - (size.X.Offset - diff);
realPos = UDim2.new(far.Position.X.Scale, xPos, original.Position.Y.Scale, original.Position.Y.Offset)
data.Name = "__TITLEBUTTON"
data.Size = size
data.Parent = Drag
data.ZIndex = data.ZIndex or original.ZIndex
data.Position = data.Position or realPos
data.TextSize = data.TextSize or original.TextSize
data.TextColor3 = data.TextColor3 or original.TextColor3
data.TextScaled = data.TextScaled or original.TextScaled
data.TextScaled = data.TextScaled or original.TextScaled
data.TextWrapped = data.TextWrapped or original.TextWrapped
data.TextStrokeColor3 = data.TextStrokeColor3 or original.TextStrokeColor3
data.TextTransparency = data.TextTransparency or original.TextTransparency
data.TextStrokeTransparency = data.TextStrokeTransparency or original.TextStrokeTransparency
data.BackgroundTransparency = data.BackgroundTransparency or original.BackgroundTransparency
data.BackgroundColor3 = data.BackgroundColor3 or original.BackgroundColor3
data.BorderSizePixel = data.BorderSizePixel or original.BorderSizePixel
--data.TextXAlignment = data.TextXAlignment or original.TextXAlignment
--data.TextYAlignment = data.TextYAlignment or original.TextYAlignment
data.Font = data.Font or original.Font
return create("TextButton", data)
end
function functionify(func, object)
if type(func) == "string" then
if object then
local env = GetEnv()
env.Object = object
return client.Core.LoadCode(func, env)
else
return client.Core.LoadCode(func)
end
else
return func
end
end
function create(class, dataFound, existing)
local data = dataFound or {}
local class = data.Class or data.ClassName or class
local new = existing or (specialInsts[class] and specialInsts[class]:Clone()) or service.New(class)
local parent = data.Parent or new.Parent
if dataFound then
data.Parent = nil
if data.Class or data.ClassName then
data.Class = nil
data.ClassName = nil
end
if not data.BorderColor3 and checkProperty(new, "BorderColor3") then
new.BorderColor3 = dBorder
end
if not data.CanvasSize and checkProperty(new, "CanvasSize") then
new.CanvasSize = dCanvasSize
end
if not data.BorderSizePixel and checkProperty(new, "BorderSizePixel") then
new.BorderSizePixel = dPixelSize
end
if not data.BackgroundColor3 and checkProperty(new, "BackgroundColor3") then
new.BackgroundColor3 = dBackground
end
if not data.PlaceholderColor3 and checkProperty(new, "PlaceholderColor3") then
new.PlaceholderColor3 = dPlaceholderColor
end
if not data.Transparency and not data.BackgroundTransparency and checkProperty(new, "Transparency") and checkProperty(new, "BackgroundTransparency") then
new.BackgroundTransparency = dTransparency
elseif data.Transparency and checkProperty(new, "BackgroundTransparency") then
new.BackgroundTransparency = data.Transparency
end
if not data.TextColor3 and not data.TextColor and checkProperty(new, "TextColor3") then
new.TextColor3 = dTextColor
elseif data.TextColor then
new.TextColor3 = data.TextColor
end
if not data.Font and checkProperty(new, "Font") then
data.Font = dFont
end
if not data.TextSize and checkProperty(new, "TextSize") then
data.TextSize = dTextSize
end
if not data.BottomImage and not data.MidImage and not data.TopImage and class == "ScrollingFrame" then
new.BottomImage = dScrollImage
new.MidImage = dScrollImage
new.TopImage = dScrollImage
end
if not data.Size and checkProperty(new, "Size") then
new.Size = dSize
end
if not data.Position and checkProperty(new, "Position") then
new.Position = dPosition
end
if not data.ZIndex and checkProperty(new, "ZIndex") then
new.ZIndex = dZIndex
if parent and checkProperty(parent, "ZIndex") then
new.ZIndex = parent.ZIndex
end
end
if data.TextChanged and class == "TextBox" then
local textChanged = functionify(data.TextChanged, new)
new.FocusLost:Connect(function(enterPressed)
textChanged(new.Text, enterPressed, new)
end)
end
if (data.OnClicked or data.OnClick) and (class == "TextButton" or class == "ImageButton") then
local debounce = false;
local doDebounce = data.Debounce;
local onClick = functionify((data.OnClicked or data.OnClick), new)
new.MouseButton1Down:Connect(function()
if not debounce then
if doDebounce then
debounce = true
end
onClick(new)
debounce = false
end
end)
end
if data.Events then
for event,func in pairs(data.Events) do
local realFunc = functionify(func, new)
Event(new[event], function(...)
realFunc(...)
end)
end
end
if data.Visible == nil then
data.Visible = true
end
if data.LabelProps then
data.LabelProperties = data.LabelProps
end
end
if class == "Entry" then
local label = new.Text
local dots = new.Dots
local desc = new.Desc
local richText = data.RichText or label.RichText
label.ZIndex = data.ZIndex or new.ZIndex
dots.ZIndex = data.ZIndex or new.ZIndex
if data.Text then
label.Text = data.Text
label.Visible = true
data.Text = nil
end
if data.Desc or data.ToolTip then
desc.Value = data.Desc or data.ToolTip
data.Desc = nil
end
Expand(new, Tooltip, nil, richText)
else
if data.ToolTip then
Expand(new, Tooltip, data.ToolTip, data.RichText)
end
end
if class == "ButtonEntry" then
local button = new.Button
local debounce = false
local onClicked = functionify(data.OnClicked, button)
new:SetSpecial("DoClick",function()
if not debounce then
debounce = true
if onClicked then
onClicked(button)
end
debounce = false
end
end)
new.Text = data.Text or new.Text
button.ZIndex = data.ZIndex or new.ZIndex
button.MouseButton1Down:Connect(new.DoClick)
end
if class == "Boolean" then
local enabled = data.Enabled
local debounce = false
local onToggle = functionify(data.OnToggle, new)
local function toggle(isEnabled)
if not debounce then
debounce = true
if (isEnabled ~= nil and isEnabled) or (isEnabled == nil and enabled) then
enabled = false
new.Text = "Disabled"
elseif (isEnabled ~= nil and isEnabled == false) or (isEnabled == nil and not enabled) then
enabled = true
new.Text = "Enabled"
end
if onToggle then
onToggle(enabled, new)
end
debounce = false
end
end
--new.ZIndex = data.ZIndex
new.Text = (enabled and "Enabled") or "Disabled"
new.MouseButton1Down:Connect(function()
if onToggle then
toggle()
end
end)
new:SetSpecial("Toggle",function(ignore, isEnabled) toggle(isEnabled) end)
end
if class == "StringEntry" then
local box = new.Box
local ignore
new.Text = data.Text or new.Text
box.ZIndex = data.ZIndex or new.ZIndex
if data.BoxText then
box.Text = data.BoxText
end
if data.BoxProperties then
for i,v in pairs(data.BoxProperties) do
if checkProperty(box, i) then
box[i] = v
end
end
end
if data.TextChanged then
local textChanged = functionify(data.TextChanged, box)
box.Changed:Connect(function(p)
if p == "Text" and not ignore then
textChanged(box.Text)
end
end)
box.FocusLost:Connect(function(enter)
local change = textChanged(box.Text, true, enter)
if change then
ignore = true
box.Text = change
ignore = false
end
end)
end
new:SetSpecial("SetValue",function(ignore, newValue) box.Text = newValue end)
end
if class == "Slider" then
local mouseIsIn = false
local posValue = new.Percentage
local slider = new.Slider
local bar = new.SliderBar
local drag = new.Drag
local moving = false
local value = 0
local onSlide = functionify(data.OnSlide, new)
bar.ZIndex = data.ZIndex or new.ZIndex
slider.ZIndex = bar.ZIndex+1
drag.ZIndex = slider.ZIndex+1
drag.Active = true
if data.Value then
slider.Position = UDim2.new(0.5, -10, 0.5, -10)
drag.Position = slider.Position
end
bar.InputBegan:Connect(function(input)
if not moving and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
value = ((input.Position.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)
if value < 0 then
value = 0
elseif value > 1 then
value = 1
end
slider.Position = UDim2.new(value, -10, 0.5, -10)
drag.Position = slider.Position
posValue.Value = value
if onSlide then
onSlide(value)
end
end
end)
drag.DragBegin:Connect(function()
moving = true
end)
drag.DragStopped:Connect(function()
moving = false
drag.Position = slider.Position
end)
drag.Changed:Connect(function()
if moving then
value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)
if value < 0 then
value = 0
elseif value > 1 then
value = 1
end
slider.Position = UDim2.new(value, -10, 0.5, -10)
posValue.Value = value
if onSlide then
onSlide(value)
end
end
end)
new:SetSpecial("SetValue",function(ignore, newValue)
if newValue and tonumber(newValue) then
value = tonumber(newValue)
posValue.Value = value
slider.Position = UDim2.new(value, -10, 0.5, -10)
drag.Position = slider.Position
end
end)
end
if class == "Dropdown" then
local menu = new.Menu
local downImg = new.Down
local selected = new.dSelected
local options = data.Options
local curSelected = data.Selected or data.Selection
local onSelect = functionify(data.OnSelection or data.OnSelect or function()end)
local textProps = data.TextProperties
local scroller = create("ScrollingFrame", {
Parent = menu;
Size = UDim2.fromScale(1, 1);
Position = UDim2.new();
BackgroundTransparency = 1;
ZIndex = 100;
})
menu.ZIndex = scroller.ZIndex
menu.Parent = GUI
menu.Visible = false
menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 100);
menu.BackgroundColor3 = data.BackgroundColor3 or new.BackgroundColor3
if data.TextAlignment then
selected.TextXAlignment = data.TextAlignment
selected.Position = UDim2.fromOffset(30, 0);
end
if data.NoArrow then
downImg.Visible = false
end
new:SetSpecial("MenuContainer", menu)
new.Changed:Connect(function(p)
if p == "AbsolutePosition" and menu.Visible then
menu.Position = UDim2.fromOffset(new.AbsolutePosition.X, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
elseif p == "AbsoluteSize" or p == "Parent" then
downImg.Size = UDim2.new(0, new.AbsoluteSize.Y, 1, 0);
if data.TextAlignment == "Right" then
downImg.Position = UDim2.new(0, 0, 0.5, -(downImg.AbsoluteSize.X/2))
selected.Position = UDim2.fromOffset(new.AbsoluteSize.Y, 0);
else
downImg.Position = UDim2.new(1, -downImg.AbsoluteSize.X, 0.5, -(downImg.AbsoluteSize.X/2))
end
selected.Size = UDim2.new(1, -downImg.AbsoluteSize.X, 1, 0);
if options and #options <= 6 then
menu.Size = UDim2.fromOffset(new.AbsoluteSize.X, 30*#options);
else
menu.Size = UDim2.fromOffset(new.AbsoluteSize.X, 30*6);
scroller:ResizeCanvas(false, true);
end
end
end)
selected.ZIndex = new.ZIndex
downImg.ZIndex = new.ZIndex
if textProps then
for i,v in pairs(textProps) do
selected[i] = v
end
end
if options then
for i,v in pairs(options) do
local button = scroller:Add("TextButton", {
Text = ` {v}`;
Size = UDim2.new(1, -10, 0, 30);
Position = UDim2.new(0, 5, 0, 30*(i-1));
ZIndex = menu.ZIndex;
BackgroundTransparency = 1;
OnClick = function()
selected.Text = v;
onSelect(v, new);
menu.Visible = false
end
})
if textProps then
for i,v in pairs(textProps) do
button[i] = v
end
end
end
if curSelected then
selected.Text = curSelected
else
selected.Text = "No Selection"
end
local function showMenu()
menu.Position = UDim2.fromOffset(new.AbsolutePosition.X, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
menu.Visible = not menu.Visible
end
selected.MouseButton1Down:Connect(showMenu)
downImg.MouseButton1Down:Connect(showMenu)
end
end
if class == "TabFrame" then
local buttonsTab = {};
local buttons = create("ScrollingFrame", nil, new.Buttons)
local frames = new.Frames
local numTabs = 0
local buttonSize = data.ButtonSize or 60
new.BackgroundTransparency = data.BackgroundTransparency or 1
buttons.ZIndex = data.ZIndex or new.ZIndex
frames.ZIndex = buttons.ZIndex
new:SetSpecial("GetTab", function(ignore, name)
return frames:FindFirstChild(name)
end)
new:SetSpecial("NewTab", function(ignore, name, data)
local data = data or {}
--local numChildren = #frames:GetChildren()
local nextPos = getNextPos(buttons);
local textSize = service.TextService:GetTextSize(data.Text or name, dTextSize, dFont, buttons.AbsoluteSize)
local oTextTrans = data.TextTransparency
local isOpen = false
local disabled = false
local tabFrame = create("ScrollingFrame",{
Name = name;
Size = UDim2.fromScale(1, 1);
Position = UDim2.new();
BorderSizePixel = 0;
BackgroundTransparency = data.FrameTransparency or data.Transparency;
BackgroundColor3 = data.Color or dSecondaryBackground;
ZIndex = buttons.ZIndex;
Visible = false;
})
local tabButton = create("TextButton",{
Name = name;
Text = data.Text or name;
Size = UDim2.new(0, textSize.X+20, 1, 0);
ZIndex = buttons.ZIndex;
Position = UDim2.new(0, (nextPos.X.Offset > 0 and nextPos.X.Offset+5) or 0, 0, 0);
TextColor3 = data.TextColor;
BackgroundTransparency = 0.7;
TextTransparency = data.TextTransparency;
BackgroundColor3 = data.Color or dSecondaryBackground;
BorderSizePixel = 0;
})
tabFrame:SetSpecial("FocusTab",function()
for i,v in ipairs(buttonsTab) do
if isGui(v) then
v.BackgroundTransparency = (v:IsDisabled() and 0.9) or 0.7
v.TextTransparency = (v:IsDisabled() and 0.9) or 0.7
end
end
for i,v in ipairs(frames:GetChildren()) do
if isGui(v) then
v.Visible = false
end
end
tabButton.BackgroundTransparency = data.Transparency or 0
tabButton.TextTransparency = data.TextTransparency or 0
tabFrame.Visible = true
if data.OnFocus then
data.OnFocus(true)
end
end)
if numTabs == 0 then
tabFrame.Visible = true
tabButton.BackgroundTransparency = data.Transparency or 0
end
tabButton.MouseButton1Down:Connect(function()
if not disabled then
tabFrame:FocusTab()
end
end)
tabButton.Parent = buttons
tabFrame.Parent = frames
buttons:ResizeCanvas(true, false)
tabFrame:SetSpecial("Disable", function()
disabled = true;
tabButton.BackgroundTransparency = 0.9;
tabButton.TextTransparency = 0.9
end)
tabFrame:SetSpecial("Enable", function()
disabled = false;
tabButton.BackgroundTransparency = 0.7;
tabButton.TextTransparency = data.TextTransparency or 0;
end)
tabButton:SetSpecial("IsDisabled", function()
return disabled;
end)
table.insert(buttonsTab, tabButton);
numTabs = numTabs+1;
return tabFrame,tabButton
end)
end
if class == "ScrollingFrame" then
local genning = false
if not data.ScrollBarThickness then
data.ScrollBarThickness = dScrollBar
end
new:SetSpecial("GenerateList", function(obj, list, labelProperties, bottom)
local list = list or obj;
local genHold = {}
local entProps = labelProperties or {}
genning = genHold
new:ClearAllChildren()
new.AutomaticCanvasSize = "Y"
local layout = service.New("UIListLayout", {
Parent = new;
Name = "LayoutOrder";
FillDirection = data.Layout_FillDirection or "Vertical";
VerticalAlignment = data.Layout_VerticalAlignment or "Top";
HorizontalAlignment = data.Layout_HorizontalAlignment or "Left";
})
local num = 0
for i,v in pairs(list) do
local text = v;
local desc;
local color
local richText;
if type(v) == "table" then
text = v.Text
desc = v.Desc
color = v.Color
if v.RichTextAllowed or entProps.RichTextAllowed then
richText = true
end
end
local label
if v.TextSelectable or entProps.TextSelectable then
label = create("TextBox",{
Text = ` {text}`;
ToolTip = desc;
Size = UDim2.new(1,-5,0,(entProps.ySize or 20));
Visible = true;
BackgroundTransparency = 1;
Font = "Arial";
TextSize = 14;
TextStrokeTransparency = 0.8;
TextXAlignment = "Left";
Position = UDim2.new(0,0,0,num*(entProps.ySize or 20));
RichText = richText or false;
TextEditable = false;
ClearTextOnFocus = false;
})
else
label = create("TextLabel",{
Text = ` {text}`;
ToolTip = desc;
Size = UDim2.new(1,-5,0,(entProps.ySize or 20));
Visible = true;
BackgroundTransparency = 1;
Font = "Arial";
TextSize = 14;
TextStrokeTransparency = 0.8;
TextXAlignment = "Left";
Position = UDim2.new(0,0,0,num*(entProps.ySize or 20));
RichText = richText or false;
})
end
if color then
label.TextColor3 = color
end
if labelProperties then
for i,v in pairs(entProps) do
if checkProperty(label, i) then
label[i] = v
end
end
end
if genning == genHold then
label.Parent = new;
else
label:Destroy()
break
end
num = num+1
if data.Delay then
if type(data.Delay) == "number" then
wait(data.Delay)
elseif i%100 == 0 then
wait(0.1)
end
end
end
--new:ResizeCanvas(false, true, false, bottom, 5, 5, 50)
if bottom then
new.CanvasPosition = Vector2.new(0, layout.AbsoluteContentSize.Y);
end
genning = nil
end)
new:SetSpecial("ResizeCanvas", function(ignore, onX, onY, xMax, yMax, xPadding, yPadding, modBreak)
local xPadding,yPadding = data.xPadding or 5, data.yPadding or 5
local newY, newX = 0,0
if not onX and not onY then onX = false onY = true end
for i,v in ipairs(new:GetChildren()) do
if v:IsA("GuiObject") then
if onY then
v.Size = UDim2.new(v.Size.X.Scale, v.Size.X.Offset, 0, v.AbsoluteSize.Y)
v.Position = UDim2.new(v.Position.X.Scale, v.Position.X.Offset, 0, v.AbsolutePosition.Y-new.AbsolutePosition.Y)
end
if onX then
v.Size = UDim2.new(0, v.AbsoluteSize.X, v.Size.Y.Scale, v.Size.Y.Offset)
v.Position = UDim2.new(0, v.AbsolutePosition.X-new.AbsolutePosition.X, v.Position.Y.Scale, v.Position.Y.Offset)
end
local yLower = v.Position.Y.Offset + v.Size.Y.Offset
local xLower = v.Position.X.Offset + v.Size.X.Offset
newY = math.max(newY, yLower)
newX = math.max(newX, xLower)
if modBreak then
if i%modBreak == 0 then
wait(1/60)
end
end
end
end
if onY then
new.CanvasSize = UDim2.new(new.CanvasSize.X.Scale, new.CanvasSize.X.Offset, 0, newY+yPadding)
end
if onX then
new.CanvasSize = UDim2.new(0, newX + xPadding, new.CanvasSize.Y.Scale, new.CanvasSize.Y.Offset)
end
if xMax then
new.CanvasPosition = Vector2.new((newX + xPadding)-new.AbsoluteSize.X, new.CanvasPosition.Y)
end
if yMax then
new.CanvasPosition = Vector2.new(new.CanvasPosition.X, (newY+yPadding)-new.AbsoluteSize.Y)
end
end)
if data.List then new:GenerateList(data.List) data.List = nil end
end
LoadChildren(new, data.Content or data.Children)
data.Children = nil
data.Content = nil
for i,v in pairs(data) do
if checkProperty(new, i) then
new[i] = v
end
end
new.Parent = parent
return apiIfy(new, data, class),data
end
function apiIfy(gui, data, class)
local newGui = service.Wrap(gui)
gui:SetSpecial("Object", gui)
gui:SetSpecial("SetPosition", function(ignore, newPos) gui.Position = newPos end)
gui:SetSpecial("SetSize", function(ingore, newSize) gui.Size = newSize end)
gui:SetSpecial("Add", function(ignore, class, data)
if not data then data = class class = ignore end
local new = create(class,data);
new.Parent = gui;
return apiIfy(new, data, class)
end)
gui:SetSpecial("Copy", function(ignore, class, gotData)
local newData = {}
local new
for i,v in pairs(data) do
newData[i] = v
end
for i,v in pairs(gotData) do
newData[i] = v
end
new = create(class or data.Class or gui.ClassName, newData);
new.Parent = gotData.Parent or gui.Parent;
return apiIfy(new, data, class)
end)
return newGui
end
function doClose()
if not isClosed then
isClosed = true
if onClose then
local r,e = pcall(onClose)
if e then
warn(e)
end
end
gTable:Destroy()
end
end
function isVisible()
return Main.Visible
end
local hideLabel = Hide:FindFirstChild("TextLabel")
function doHide(doHide)
local origLH = Hide.LineHeight
if doHide or (doHide == nil and Main.Visible) then
dragSize = Drag.Size
Main.Visible = false
Drag.BackgroundTransparency = Main.BackgroundTransparency
Drag.BackgroundColor3 = Main.BackgroundColor3
Drag.Size = UDim2.new(0, 200, Drag.Size.Y.Scale, Drag.Size.Y.Offset)
if hideLabel then
hideLabel.Text = "+"
else
Hide.Text = "+"
end
Hide.LineHeight = origLH
gTable.Minimized = true
elseif doHide == false or (doHide == nil and not Main.Visible) then
Main.Visible = true
Drag.BackgroundTransparency = 1
Drag.Size = dragSize or Drag.Size
if hideLabel then
hideLabel.Text = "-"
else
Hide.Text = "-"
end
Hide.LineHeight = origLH
gTable.Minimized = false
end
if onMinimize then
onMinimize(Main.Visible)
end
if Walls then
wallPosition()
end
end
function isInFrame(x, y, frame)
if x > frame.AbsolutePosition.X and x < (frame.AbsolutePosition.X+frame.AbsoluteSize.X) and y > frame.AbsolutePosition.Y and y < (frame.AbsolutePosition.Y+frame.AbsoluteSize.Y) then
return true
else
return false
end
end
function wallPosition()
if gTable.Active then
local x,y = Drag.AbsolutePosition.X, Drag.AbsolutePosition.Y
local abx, gx, gy = Drag.AbsoluteSize.X, GUI.AbsoluteSize.X, GUI.AbsoluteSize.Y
local ySize = (Main.Visible and Main.AbsoluteSize.Y) or Drag.AbsoluteSize.Y
if x < 0 then
Drag.Position = UDim2.new(0, 0, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
end
if y < 0 then
Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, 0)
end
if x + abx > gx then
Drag.Position = UDim2.new(0, GUI.AbsoluteSize.X - Drag.AbsoluteSize.X, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
end
if y + ySize > gy then
Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, GUI.AbsoluteSize.Y - ySize)
end
end
end
function setSize(newSize)
if newSize and type(newSize) == "table" then
if newSize[1] < 50 then newSize[1] = 50 end
if newSize[2] < 50 then newSize[2] = 50 end
Drag.Size = UDim2.new(0,newSize[1],Drag.Size.Y.Scale,Drag.Size.Y.Offset)
Main.Size = UDim2.new(1,0,0,newSize[2])
end
end
function setPosition(newPos)
if newPos and typeof(newPos) == "UDim2" then
Drag.Position = newPos
elseif newPos and type(newPos) == "table" then
Drag.Position = UDim2.new(0, newPos[1], 0, newPos[2])
elseif Size and not newPos then
Drag.Position = UDim2.new(0.5, -Drag.AbsoluteSize.X/2, 0.5, -Main.AbsoluteSize.Y/2)
end
end
if Name then
gTable.Name = Name
if data.AllowMultiple ~= nil and data.AllowMultiple == false then
local found, num = client.UI.Get(Name, GUI, true)
if found then
doClose()
return nil
end
end
end
if Size then
setSize(Size)
end
if Position then
setPosition(Position)
end
if Title then
Titlef.Text = Title
end
if CanKeepAlive or not ResetOnSpawn then
gTable.CanKeepAlive = true
GUI.ResetOnSpawn = false
elseif ResetOnSpawn then
gTable.CanKeepAlive = false
GUI.ResetOnSpawn = true
end
if Icon then
Iconf.Visible = true
Iconf.Image = Icon
Iconf.Size = UDim2.new(0, 16, 0, 16)
Iconf.Position = UDim2.new(0, 6, 0, 5)
Iconf.ImageTransparency = 0
end
if CanvasSize then
ScrollFrame.CanvasSize = CanvasSize
end
if noClose then
Close.Visible = false
Refresh.Position = Hide.Position
Hide.Position = Close.Position
end
if noHide then
Hide.Visible = false
Refresh.Position = Hide.Position
end
if Walls then
Drag.DragStopped:Connect(function()
wallPosition()
end)
end
if onRefresh then
local debounce = false
function DoRefresh()
if not Refreshing then
local done = false
Refreshing = true
spawn(function()
while gTable.Active and not done do
for i = 0,180,10 do
rSpinner.Rotation = -i
wait(1/60)
end
end
end)
onRefresh()
wait(1)
done = true
Refreshing = false
end
end
Refresh.MouseButton1Down:Connect(function()
if not debounce then
debounce = true
DoRefresh()
debounce = false
end
end)
Titlef.Size = UDim2.new(1, -130, Titlef.Size.Y.Scale, Titlef.Size.Y.Offset)
else
Refresh.Visible = false
end
if iconClicked then
Iconf.MouseButton1Down(function()
iconClicked(data, GUI, Iconf)
end)
end
if Menu then
data.Menu.Text = ""
data.Menu.Parent = Main
data.Menu.Size = UDim2.new(1,-10,0,25)
data.Menu.Position = UDim2.new(0,5,0,25)
ScrollFrame.Size = UDim2.new(1,-10,1,-55)
ScrollFrame.Position = UDim2.new(0,5,0,50)
data.Menu.BackgroundColor3 = Color3.fromRGB(216, 216, 216)
data.Menu.BorderSizePixel = 0
create("TextLabel",data.Menu)
end
if not SizeLocked then
local startXPos = Drag.AbsolutePosition.X
local startYPos = Drag.AbsolutePosition.Y
local startXSize = Drag.AbsoluteSize.X
local startYSize = Drag.AbsoluteSize.Y
local vars = client.Variables
local newIcon
local inFrame
local ReallyInFrame
local function readify(obj)
obj.MouseEnter:Connect(function()
ReallyInFrame = obj
end)
obj.MouseLeave:Connect(function()
if ReallyInFrame == obj then
ReallyInFrame = nil
end
end)
end
--[[
readify(Drag)
readify(ScrollFrame)
readify(TopRight)
readify(TopLeft)
readify(RightCorner)
readify(LeftCorner)
readify(RightSide)
readify(LeftSide)
readify(Bottom)
readify(Top)
--]]
function checkMouse(x, y) --// Update later to remove frame by frame pos checking
if gTable.Active and Main.Visible then
if isInFrame(x, y, Drag) or isInFrame(x, y, ScrollFrame) then
inFrame = nil
newIcon = nil
elseif isInFrame(x, y, TopRight) then
inFrame = "TopRight"
newIcon = MouseIcons.TopRight
elseif isInFrame(x, y, TopLeft) then
inFrame = "TopLeft"
newIcon = MouseIcons.TopLeft
elseif isInFrame(x, y, RightCorner) then
inFrame = "RightCorner"
newIcon = MouseIcons.RightCorner
elseif isInFrame(x, y, LeftCorner) then
inFrame = "LeftCorner"
newIcon = MouseIcons.LeftCorner
elseif isInFrame(x, y, RightSide) then
inFrame = "RightSide"
newIcon = MouseIcons.Horizontal
elseif isInFrame(x, y, LeftSide) then
inFrame = "LeftSide"
newIcon = MouseIcons.Horizontal
elseif isInFrame(x, y, Bottom) then
inFrame = "Bottom"
newIcon = MouseIcons.Vertical
elseif isInFrame(x, y, Top) then
inFrame = "Top"
newIcon = MouseIcons.Vertical
else
inFrame = nil
newIcon = nil
end
else
inFrame = nil
end
if (not client.Variables.MouseLockedBy) or client.Variables.MouseLockedBy == gTable then
if inFrame and newIcon then
Mouse.Icon = newIcon
client.Variables.MouseLockedBy = gTable
elseif client.Variables.MouseLockedBy == gTable then
Mouse.Icon = curIcon
client.Variables.MouseLockedBy = nil
end
end
end
local function inputStart(x, y)
checkMouse(x, y)
if gTable.Active and inFrame and not Resizing and not isInFrame(x, y, ScrollFrame) and not isInFrame(x, y, Drag) then
Resizing = inFrame
startXPos = Drag.AbsolutePosition.X
startYPos = Drag.AbsolutePosition.Y
startXSize = Drag.AbsoluteSize.X
startYSize = Main.AbsoluteSize.Y
end
end
local function inputEnd()
if gTable.Active then
if Resizing and onResize then
onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
end
Resizing = nil
Mouse.Icon = curIcon
--DragEnabled = true
--if Walls then
-- wallPosition()
--end
end
end
local function inputMoved(x, y)
if gTable.Active then
if Mouse.Icon ~= MouseIcons.TopRight and Mouse.Icon ~= MouseIcons.TopLeft and Mouse.Icon ~= MouseIcons.RightCorner and Mouse.Icon ~= MouseIcons.LeftCorner and Mouse.Icon ~= MouseIcons.Horizontal and Mouse.Icon ~= MouseIcons.Vertical then
curIcon = Mouse.Icon
end
if Resizing then
local moveX = false
local moveY = false
local newPos = Drag.Position
local xPos, yPos = x, y
local newX, newY = startXSize, startYSize
--DragEnabled = false
if Resizing == "TopRight" then
newX = (xPos - startXPos) + 3
newY = (startYPos - yPos) + startYSize -1
moveY = true
elseif Resizing == "TopLeft" then
newX = (startXPos - xPos) + startXSize -1
newY = (startYPos - yPos) + startYSize -1
moveY = true
moveX = true
elseif Resizing == "RightCorner" then
newX = (xPos - startXPos) + 3
newY = (yPos - startYPos) + 3
elseif Resizing == "LeftCorner" then
newX = (startXPos - xPos) + startXSize + 3
newY = (yPos - startYPos) + 3
moveX = true
elseif Resizing == "LeftSide" then
newX = (startXPos - xPos) + startXSize + 3
newY = startYSize
moveX = true
elseif Resizing == "RightSide" then
newX = (xPos - startXPos) + 3
newY = startYSize
elseif Resizing == "Bottom" then
newX = startXSize
newY = (yPos - startYPos) + 3
elseif Resizing == "Top" then
newX = startXSize
newY = (startYPos - yPos) + startYSize - 1
moveY = true
end
if newX < MinSize[1] then newX = MinSize[1] end
if newY < MinSize[2] then newY = MinSize[2] end
if newX > MaxSize[1] then newX = MaxSize[1] end
if newY > MaxSize[2] then newY = MaxSize[2] end
if moveX then
newPos = UDim2.new(0, (startXPos+startXSize)-newX, newPos.Y.Scale, newPos.Y.Offset)
end
if moveY then
newPos = UDim2.new(newPos.X.Scale, newPos.X.Offset, 0, (startYPos+startYSize)-newY)
end
Drag.Position = newPos
Drag.Size = UDim2.new(0, newX, Drag.Size.Y.Scale, Drag.Size.Y.Offset)
Main.Size = UDim2.new(Main.Size.X.Scale, Main.Size.X.Offset, 0, newY)
if not Titlef.TextFits then
Titlef.Visible = false
else
Titlef.Visible = true
end
else
checkMouse(x, y)
end
end
end
Event(InputService.InputBegan, function(input, gameHandled)
if not gameHandled and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
local Position = input.Position
inputStart(Position.X, Position.Y)
end
end)
Event(InputService.InputChanged, function(input, gameHandled)
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
local Position = input.Position
inputMoved(Position.X, Position.Y)
end
end)
Event(InputService.InputEnded, function(input, gameHandled)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
inputEnd()
end
end)
--[[Event(Mouse.Button1Down, function()
if gTable.Active and inFrame and not Resizing and not isInFrame(Mouse.X, Mouse.Y, ScrollFrame) and not isInFrame(Mouse.X, Mouse.Y, Drag) then
Resizing = inFrame
startXPos = Drag.AbsolutePosition.X
startYPos = Drag.AbsolutePosition.Y
startXSize = Drag.AbsoluteSize.X
startYSize = Main.AbsoluteSize.Y
checkMouse()
end
end)
Event(Mouse.Button1Up, function()
if gTable.Active then
if Resizing and onResize then
onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
end
Resizing = nil
Mouse.Icon = curIcon
--if Walls then
-- wallPosition()
--end
end
end)--]]
else
LeftSizeIcon.Visible = false
RightSizeIcon.Visible = false
end
Close.MouseButton1Down:Connect(doClose)
Hide.MouseButton1Down:Connect(function() doHide() end)
gTable.CustomDestroy = function()
if client.Variables.MouseLockedBy == gTable then
Mouse.Icon = curIcon
client.Variables.MouseLockedBy = nil
end
if not isClosed then
isClosed = true
if onClose then
onClose()
end
end
service.UnWrap(GUI):Destroy()
end
for i,child in ipairs(GUI:GetChildren()) do
if child.Name ~= "Desc" and child.Name ~= "Drag" then
specialInsts[child.Name] = child
child.Parent = nil
end
end
--// Drag & DisplayOrder Handler
do
local windowValue = Instance.new("BoolValue", GUI)
local dragDragging = false
local dragOffset
local inFrame
windowValue.Name = "__ADONIS_WINDOW"
Event(Main.InputBegan, function(input)
if gTable.Active and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
BringToFront()
end
end)
Event(Drag.InputBegan, function(input)
if gTable.Active then
inFrame = true
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
BringToFront()
end
end
end)
Event(Drag.InputChanged, function(input)
if gTable.Active then
inFrame = true
end
end)
Event(Drag.InputEnded, function(input)
inFrame = false
end)
Event(InputService.InputBegan, function(input)
if inFrame and GUI.DisplayOrder == 101 and not dragDragging and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then--isInFrame(input.Position.X, input.Position.Y, object) then
dragDragging = true
BringToFront()
dragOffset = Vector2.new(Drag.AbsolutePosition.X - input.Position.X, Drag.AbsolutePosition.Y - input.Position.Y)
end
end)
Event(InputService.InputChanged, function(input)
if dragDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
Drag.Position = UDim2.fromOffset(dragOffset.X + input.Position.X, dragOffset.Y + input.Position.Y)
end
end)
Event(InputService.InputEnded, function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragDragging = false
end
end)
end
--// Finishing up
local api = apiIfy(ScrollFrame, data)
local meta = api:GetMetatable()
local oldNewIndex = meta.__newindex
local oldIndex = meta.__index
create("ScrollingFrame", nil, ScrollFrame)
LoadChildren(api, Content)
api:SetSpecial("gTable", gTable)
api:SetSpecial("Window", GUI)
api:SetSpecial("Main", Main)
api:SetSpecial("Title", Titlef)
api:SetSpecial("Dragger", Drag)
api:SetSpecial("Destroy", doClose)
api:SetSpecial("Close", doClose)
api:SetSpecial("Object", ScrollFrame)
api:SetSpecial("Refresh", DoRefresh)
api:SetSpecial("AddTitleButton", function(ignore, data) if type(ignore) == "table" and not data then data = ignore end return addTitleButton(data) end)
api:SetSpecial("Ready", function() if onReady then onReady() end gTable.Ready() BringToFront() end)
api:SetSpecial("BindEvent", function(ignore, ...) Event(...) end)
api:SetSpecial("Hide", function(ignore, hide) doHide(hide) end)
api:SetSpecial("SetTitle", function(ignore, newTitle) Titlef.Text = newTitle end)
api:SetSpecial("SetPosition", function(ignore, newPos) setPosition(newPos) end)
api:SetSpecial("SetSize", function(ignore, newSize) setSize(newSize) end)
api:SetSpecial("GetPosition", function() return Drag.AbsolutePosition end)
api:SetSpecial("GetSize", function() return Main.AbsoluteSize end)
api:SetSpecial("IsVisible", isVisible)
api:SetSpecial("IsClosed", isClosed)
meta.__index = function(tab, ind)
if ind == "IsVisible" then
return isVisible()
elseif ind == "Closed" then
return isClosed
else
return oldIndex(tab, ind)
end
end
setSize(Size)
setPosition(Position)
if Ready then
gTable:Ready()
BringToFront()
end
return api,GUI
end
|
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
-- Event Handlers
|
function OnRayHit(cast, raycastResult, segmentVelocity, cosmeticBulletObject)
-- This function will be connected to the Caster's "RayHit" event.
local hitPart = raycastResult.Instance
local hitPoint = raycastResult.Position
local normal = raycastResult.Normal
if hitPart ~= nil and hitPart.Parent ~= nil then -- Test if we hit something
local humanoid = hitPart.Parent:FindFirstChildOfClass("Humanoid") -- Is there a humanoid?
if humanoid then
local Player = Players:GetPlayerFromCharacter(Tool.Parent)
humanoid.Health -= 100
TagHumanoid(humanoid, Player)
end
MakeParticleFX(hitPoint, normal) -- Particle FX
end
end
function OnRayPierced(cast, raycastResult, segmentVelocity, cosmeticBulletObject)
-- You can do some really unique stuff with pierce behavior - In reality, pierce is just the module's way of asking "Do I keep the bullet going, or do I stop it here?"
-- You can make use of this unique behavior in a manner like this, for instance, which causes bullets to be bouncy.
local position = raycastResult.Position
local normal = raycastResult.Normal
local newNormal = Reflect(normal, segmentVelocity.Unit)
cast:SetVelocity(newNormal * segmentVelocity.Magnitude)
-- It's super important that we set the cast's position to the ray hit position. Remember: When a pierce is successful, it increments the ray forward by one increment.
-- If we don't do this, it'll actually start the bounce effect one segment *after* it continues through the object, which for thin walls, can cause the bullet to almost get stuck in the wall.
cast:SetPosition(position)
-- Generally speaking, if you plan to do any velocity modifications to the bullet at all, you should use the line above to reset the position to where it was when the pierce was registered.
end
function OnRayUpdated(cast, segmentOrigin, segmentDirection, length, segmentVelocity, cosmeticBulletObject)
-- Whenever the caster steps forward by one unit, this function is called.
-- The bullet argument is the same object passed into the fire function.
if cosmeticBulletObject == nil then return end
local bulletLength = cosmeticBulletObject.Size.Z / 2 -- This is used to move the bullet to the right spot based on a CFrame offset
local baseCFrame = CFrame.new(segmentOrigin, segmentOrigin + segmentDirection)
cosmeticBulletObject.CFrame = baseCFrame * CFrame.new(0, 0, -(length - bulletLength))
end
function OnRayTerminated(cast)
local cosmeticBullet = cast.RayInfo.CosmeticBulletObject
if cosmeticBullet ~= nil then
-- This code here is using an if statement on CastBehavior.CosmeticBulletProvider so that the example gun works out of the box.
-- In your implementation, you should only handle what you're doing (if you use a PartCache, ALWAYS use ReturnPart. If not, ALWAYS use Destroy.
if CastBehavior.CosmeticBulletProvider ~= nil then
CastBehavior.CosmeticBulletProvider:ReturnPart(cosmeticBullet)
else
cosmeticBullet:Destroy()
end
end
end
MouseEvent.OnServerEvent:Connect(function (clientThatFired, mousePoint)
if not CanFire then
return
end
CanFire = false
local mouseDirection = (mousePoint - FirePointObject.WorldPosition).Unit
for i = 1, BULLETS_PER_SHOT do
Fire(mouseDirection)
end
if FIRE_DELAY > 0.03 then wait(FIRE_DELAY) end
CanFire = true
end)
Caster.RayHit:Connect(OnRayHit)
Caster.RayPierced:Connect(OnRayPierced)
Caster.LengthChanged:Connect(OnRayUpdated)
Caster.CastTerminating:Connect(OnRayTerminated)
Tool.Equipped:Connect(function ()
CastParams.FilterDescendantsInstances = {Tool.Parent, CosmeticBulletsFolder}
end)
|
--Scripted By Vurpri
--Used as Contribution to Horizon Online--
--https://www.roblox.com/groups/5337170/Horizon-Online#!/about
| |
------------------------------------------------------------------
|
local LockGUI = nil
local AimGUI = nil
local TargetPlayer = nil
local Locked = false
local Targeting = false
|
--// MAIN CODE
|
torso = character:WaitForChild("HumanoidRootPart")
joint = character:FindFirstChild("RootJoint", true)
baseC1 = joint.C1
cr = coroutine.resume
cc = coroutine.create
local function getangles()
local side = torso.CFrame.RightVector:Dot(humanoid.MoveDirection)
local front = torso.CFrame.LookVector:Dot(humanoid.MoveDirection)
if frontenabled then
return side, front*frontmultiplier
else
return side, 0
end
end
humanoid.Died:connect(function()
script.Disabled = true
end)
game:GetService("RunService").Heartbeat:Connect(function()
local side, front = getangles()
joint.C1 = joint.C1:Lerp(baseC1 * CFrame.Angles(math.rad(-front*maxtilt*(humanoid.WalkSpeed/8)),0,math.rad(side*maxtilt*(humanoid.WalkSpeed/16))), stiffness/50)
local ctick = tick()
if humanoid.MoveDirection.Magnitude > 0 then
cr(cc(function()
local bobx = math.cos(ctick * 7.5) * .25
local boby = math.abs(math.sin(ctick * 7.5)) * .25
local bob = Vector3.new(bobx, boby, 0)
humanoid.CameraOffset = humanoid.CameraOffset:lerp(bob, .25)
end))
else
humanoid.CameraOffset = humanoid.CameraOffset * .75
end
end)
|
-- debug.profileend()
|
return ReturnColor
end
end;
NumberRange = function(V0, V1)
local Min0, Max0 = V0.Min, V0.Max
local DeltaMin, DeltaMax = V1.Min - Min0, V1.Max - Max0
return function(DeltaTime)
return NumberRange.new(Min0 + DeltaTime * DeltaMin, Max0 + DeltaTime * DeltaMax)
end
end;
NumberSequenceKeypoint = function(V0, V1)
local T0, V0, E0 = V0.Time, V0.Value, V0.Envelope
local DT, DV, DE = V1.Time - T0, V1.Value - V0, V1.Envelope - E0
return function(DeltaTime)
return NumberSequenceKeypoint.new(T0 + DeltaTime * DT, V0 + DeltaTime * DV, E0 + DeltaTime * DE)
end
end;
PhysicalProperties = function(V0, V1)
local D0, E0, EW0, F0, FW0 =
V0.Density, V0.Elasticity,
V0.ElasticityWeight, V0.Friction,
V0.FrictionWeight
local DD, DE, DEW, DF, DFW =
V1.Density - D0, V1.Elasticity - E0,
V1.ElasticityWeight - EW0, V1.Friction - F0,
V1.FrictionWeight - FW0
return function(DeltaTime)
return PhysicalProperties.new(
D0 + DeltaTime * DD,
E0 + DeltaTime * DE, EW0 + DeltaTime * DEW,
F0 + DeltaTime * DF, FW0 + DeltaTime * DFW
)
end
end;
Ray = function(V0, V1)
local O0, D0, O1, D1 = V0.Origin, V0.Direction, V1.Origin, V1.Direction
local OX0, OY0, OZ0, DX0, DY0, DZ0 = O0.X, O0.Y, O0.Z, D0.X, D0.Y, D0.Z
local DOX, DOY, DOZ, DDX, DDY, DDZ = O1.X - OX0, O1.Y - OY0, O1.Z - OZ0, D1.X - DX0, D1.Y - DY0, D1.Z - DZ0
return function(DeltaTime)
return Ray.new(
Vector3.new(OX0 + DeltaTime * DOX, OY0 + DeltaTime * DOY, OZ0 + DeltaTime * DOZ),
Vector3.new(DX0 + DeltaTime * DDX, DY0 + DeltaTime * DDY, DZ0 + DeltaTime * DDZ)
)
end
end;
UDim = function(V0, V1)
local SC, OF = V0.Scale, V0.Offset
local DSC, DOF = V1.Scale - SC, V1.Offset - OF
return function(DeltaTime)
return UDim.new(SC + DeltaTime * DSC, OF + DeltaTime * DOF)
end
end;
UDim2 = RobloxLerp;
Vector2 = RobloxLerp;
Vector3 = RobloxLerp;
Rect = function(V0, V1)
return function(DeltaTime)
return Rect.new(
V0.Min.X + DeltaTime * (V1.Min.X - V0.Min.X), V0.Min.Y + DeltaTime * (V1.Min.Y - V0.Min.Y),
V0.Max.X + DeltaTime * (V1.Max.X - V0.Max.X), V0.Max.Y + DeltaTime * (V1.Max.Y - V0.Max.Y)
)
end
end;
Region3 = function(V0, V1)
return function(DeltaTime)
local imin = Lerp(V0.CFrame * (-V0.Size / 2), V1.CFrame * (-V1.Size / 2), DeltaTime)
local imax = Lerp(V0.CFrame * (V0.Size / 2), V1.CFrame * (V1.Size / 2), DeltaTime)
local iminx = imin.X
local imaxx = imax.X
local iminy = imin.Y
local imaxy = imax.Y
local iminz = imin.Z
local imaxz = imax.Z
return Region3.new(
Vector3.new(iminx < imaxx and iminx or imaxx, iminy < imaxy and iminy or imaxy, iminz < imaxz and iminz or imaxz),
Vector3.new(iminx > imaxx and iminx or imaxx, iminy > imaxy and iminy or imaxy, iminz > imaxz and iminz or imaxz)
)
end
end;
NumberSequence = function(V0, V1)
return function(DeltaTime)
local keypoints = {}
local addedTimes = {}
local keylength = 0
for _, ap in ipairs(V0.Keypoints) do
local closestAbove, closestBelow
for _, bp in ipairs(V1.Keypoints) do
if bp.Time == ap.Time then
closestAbove, closestBelow = bp, bp
break
elseif bp.Time < ap.Time and (closestBelow == nil or bp.Time > closestBelow.Time) then
closestBelow = bp
elseif bp.Time > ap.Time and (closestAbove == nil or bp.Time < closestAbove.Time) then
closestAbove = bp
end
end
local bValue, bEnvelope
if closestAbove == closestBelow then
bValue, bEnvelope = closestAbove.Value, closestAbove.Envelope
else
local p = (ap.Time - closestBelow.Time) / (closestAbove.Time - closestBelow.Time)
bValue = (closestAbove.Value - closestBelow.Value) * p + closestBelow.Value
bEnvelope = (closestAbove.Envelope - closestBelow.Envelope) * p + closestBelow.Envelope
end
local interValue = (bValue - ap.Value) * DeltaTime + ap.Value
local interEnvelope = (bEnvelope - ap.Envelope) * DeltaTime + ap.Envelope
local interp = NumberSequenceKeypoint.new(ap.Time, interValue, interEnvelope)
keylength = keylength + 1
keypoints[keylength] = interp
addedTimes[ap.Time] = true
end
for _, bp in ipairs(V1.Keypoints) do
if not addedTimes[bp.Time] then
local closestAbove, closestBelow
for _, ap in ipairs(V0.Keypoints) do
if ap.Time == bp.Time then
closestAbove, closestBelow = ap, ap
break
elseif ap.Time < bp.Time and (closestBelow == nil or ap.Time > closestBelow.Time) then
closestBelow = ap
elseif ap.Time > bp.Time and (closestAbove == nil or ap.Time < closestAbove.Time) then
closestAbove = ap
end
end
local aValue, aEnvelope
if closestAbove == closestBelow then
aValue, aEnvelope = closestAbove.Value, closestAbove.Envelope
else
local p = (bp.Time - closestBelow.Time) / (closestAbove.Time - closestBelow.Time)
aValue = (closestAbove.Value - closestBelow.Value) * p + closestBelow.Value
aEnvelope = (closestAbove.Envelope - closestBelow.Envelope) * p + closestBelow.Envelope
end
local interValue = (bp.Value - aValue) * DeltaTime + aValue
local interEnvelope = (bp.Envelope - aEnvelope) * DeltaTime + aEnvelope
local interp = NumberSequenceKeypoint.new(bp.Time, interValue, interEnvelope)
keylength = keylength + 1
keypoints[keylength] = interp
end
end
table.sort(keypoints, SortByTime)
return NumberSequence.new(keypoints)
end
end;
}, {
__index = function(_, Index)
error("No lerp function is defined for type " .. tostring(Index) .. ".", 4)
end;
__newindex = function(_, Index)
error("No lerp function is defined for type " .. tostring(Index) .. ".", 4)
end;
})
return Lerps
|
--[[ Script Variables ]]
|
--
while not Players.LocalPlayer do
wait()
end
local LocalPlayer = Players.LocalPlayer
local CachedHumanoid = nil
local IsFollowStick = true
local ThumbstickFrame = nil
local MoveTouchObject = nil
local OnTouchEnded = nil -- defined in Create()
local OnTouchMovedCn = nil
local OnTouchEndedCn = nil
|
--GoPro Hero 4 By RikOne2@InSpare
|
function OnClick(player)
if player and (not player.PlayerGui:FindFirstChild("GUI")) then
script.Parent.GUI:Clone().Parent = player.PlayerGui
end
end
script.Parent.GUI.Button.V.Value = script.Parent
script.Parent.CD.MouseClick:connect(OnClick)
|
--Cause: Dried Capacitors Losing Charge
|
while true do
if script.Parent.Parent.Sound.Sound.PlaybackSpeed > 0.95 then
tone = ((((script.Parent.Parent.Sound.Sound.PlaybackSpeed*4/script.Divisor.Value*script.Multiplier.Value)*script.Speed.Value)*2)/10000)
script.Parent.Parent.Sound.Sound.PlaybackSpeed = script.Parent.Parent.Sound.Sound.PlaybackSpeed + tone
script.Parent.Parent.Sound.Sound2.PlaybackSpeed = script.Parent.Parent.Sound.Sound2.PlaybackSpeed + tone
wait()
else
wait(math.random(5,30))
end
wait()
end
|
-- Runs whenever a player leaves the game. If that player was actually in the game, removes them from the table and checks for game over state
|
game.Players.PlayerRemoving:Connect(removeActivePlayer)
AddActivePlayer.OnServerEvent:Connect(addActivePlayer)
RemoveActivePlayer.OnServerEvent:Connect(removeActivePlayer)
|
--shadow softness
|
local amplitudeS = .2
local offsetS = .8
|
--// 스크립트 \\--
|
while wait(0.2) do
for _,v in pairs(Main:GetChildren()) do
if v:isA("Part") then
Found = false
local hitbox = Region3.new(v.Position - (v.Size/2), v.Position + (v.Size/2))
local Char = Player.Character or Player.CharacterAdded:Wait()
local list = workspace:FindPartsInRegion3WithWhiteList(hitbox, Char:GetDescendants())
for _, Filter in pairs(list) do
if Filter:FindFirstAncestor(Player.Name) then
Found = true
break
else
Found = false
end
end
if Found == true then
for _,v in pairs(Main:WaitForChild(v.Name.."Music"):GetChildren()) do
if v:isA("Sound") and v.IsPlaying == false then
v:Play()
break
end
end
else
for _,v in pairs(Main:WaitForChild(v.Name.."Music"):GetChildren()) do
if v:isA("Sound") then
v:Stop()
end
end
end
end
end
end
|
-- MOVING PLATFORM SETTINGS - Edit the settings to change how the platform works.
|
moveDelay = 4 -- The delay (in seconds) for moving between destinations.
topSpeed = 30 -- The maximum speed that the platform can move at.
|
-- Target finding state
|
local target = nil
local newTarget = nil
local newTargetDistance = nil
local searchIndex = 0
local timeSearchEnded = 0
local searchRegion = nil
local searchParts = nil
|
--Loop For Making Rays For The Bullet's Trajectory
|
for i = 1, 30 do
--print("Travelling")
local thisOffset = offset + Vector3.new(0, yOffset*(i-1), 0)
local travelRay = Ray.new(point1,thisOffset)
acceptable = false
while not acceptable do
hit, position = workspace:FindPartOnRayWithIgnoreList(travelRay, ignoreList)
if hit then
--print(hit.Name)
if hit.Name == "FakeTrack" or hit.Name == "Flash" then
ignoreList[#ignoreList+1] = hit
--print("Un-Acceptable")
else
--print("Acceptable")
acceptable = true
end
else
--print("Acceptable")
acceptable = true
end
end
local distance = (position - point1).magnitude
round.Size = Vector3.new(0.6, distance, 0.6)
round.CFrame = CFrame.new(position, point1)
* CFrame.new(0, 0, -distance/2)
* CFrame.Angles(math.rad(90),0,0)
round.Parent = Workspace
point1 = point1 + thisOffset
allied = false
if hit and hit.Parent then --if we hit something
--print("Bullet Hit Something")
if hit.Parent.Parent then --look if what we hit is a tank
tank = hit.Parent.Parent:findFirstChild("Tank")
if not tank and hit.Parent.Parent.Parent then
tank = hit.Parent.Parent.Parent:findFirstChild("Tank")
if not tank and hit.Parent.Parent.Parent.Parent then
local tank = hit.Parent.Parent.Parent.Parent:findFirstChild("Tank")
if not tank and hit.Parent.Parent.Parent.Parent.Parent then
local tank = hit.Parent.Parent.Parent.Parent.Parent:findFirstChild("Tank")
end
end
end
end
if tank then --if it is a tank
--print("Hit a Tank")
if tank.Value == BrickColor.new("Bright red") then --if we hit an ally
allied = true
--print("Tank is an ally")
end
end
if not allied then
round:remove()
local e = Instance.new("Explosion")
e.BlastRadius = 3
e.BlastPressure = 1700
e.ExplosionType = Enum.ExplosionType.NoCraters
e.DestroyJointRadiusPercent = 1.3
e.Position = position
e.Parent = Workspace
local impactPos = CFrame.new(point1,point1 + thisOffset)-point1+position
for angle = 1, 360, 40 do
ray(angle,1.5, impactPos)
ray(angle,3, impactPos)
--wait()
end
round:remove()
break
elseif hit and allied then
round:remove()
break
end
end
wait()
end
if round then
round:remove()
end
script:remove()
|
-- playToolAnimation("toolnone", toolTransitionTime, Humanoid)
|
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid)
return
end
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder:SetDesiredAngle(3.14 /2)
LeftShoulder:SetDesiredAngle(-3.14 /2)
RightHip:SetDesiredAngle(3.14 /2)
LeftHip:SetDesiredAngle(-3.14 /2)
end
local lastTick = 0
function move(time)
local amplitude = 1
local frequency = 1
local deltaTime = time - lastTick
lastTick = time
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
elseif (pose == "Seated") then
stopAllAnimations()
moveSit()
return
elseif (pose == "Running") then
playAnimation("walk", 0.1, Humanoid)
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
|
-- Regeneration
|
function regenHealth()
if Regening then return end
Regening = true
while Humanoid.Health < Humanoid.MaxHealth do
local waiting = wait(1)
local health = Humanoid.Health
if health > 0 and health < Humanoid.MaxHealth then
local newHealthDelta = 0.01 * waiting * Humanoid.MaxHealth
health = health + newHealthDelta
Humanoid.Health = math.min(health,Humanoid.MaxHealth)
end
end
if Humanoid.Health > Humanoid.MaxHealth then
Humanoid.Health = Humanoid.MaxHealth
end
Regening = false
end
Humanoid.HealthChanged:connect(regenHealth)
|
--DevelopmentStatus
|
Seagull = script.Parent
RunService = game:GetService("RunService")
Torso = Seagull:WaitForChild("Body")
LeftWing = Seagull:WaitForChild("LeftWing")
RightWing = Seagull:WaitForChild("RightWing")
LeftMotor = Torso:WaitForChild("LeftMotor")
RightMotor = Torso:WaitForChild("RightMotor")
|
--[=[
This module provides utility functions for strings
@class String
]=]
|
local String = {}
|
-- / Game Assets / --
|
local GameAssets = game.ServerStorage.GameAssets
local Tools = GameAssets.Tools
|
-- slash effect when clicking mouse
|
local function slash()
local owner = tool.Parent
local str = Instance.new("StringValue")
str.Name = "toolanim"
str.Value = "Slash"
str.Parent = tool
end
tool.Activated:Connect(slash)
|
--// Extras
|
WalkAnimEnabled = true; -- Set to false to disable walking animation, true to enable
SwayEnabled = true; -- Set to false to disable sway, true to enable
|
-----------------
--| Constants |--
-----------------
|
local GRAVITY_ACCELERATION = workspace.Gravity
local RELOAD_TIME = 3 -- Seconds until tool can be used again
local ROCKET_SPEED = 2 -- Speed of the projectile
local MISSILE_MESH_ID = 'http://www.roblox.com/asset/?id=2251534'
local MISSILE_MESH_SCALE = Vector3.new(0.35, 0.35, 0.25)
local ROCKET_PART_SIZE = Vector3.new(1.2, 1.2, 3.27)
|
--Give player when buy
|
player:WaitForChild("BackpackShop").Equipped.Changed:Connect(function()
if character:FindFirstChild("Backpack") then
character.Backpack:Remove()
local a = game.ServerStorage.Backpacks[equipped.Value]:Clone()
a.Name = "Backpack"
a.Parent = character
end
end)
end)
end)
|
--Tune
|
OverheatSpeed = .2 --How fast the car will overheat
CoolingEfficiency = .1 --How fast the car will cool down
RunningTemp = 85 --In degrees
Fan = true --Cooling fan
FanTemp = 100 --At what temperature the cooling fan will activate
FanSpeed = .03
FanVolume = .2
BlowupTemp = 130 --At what temperature the engine will blow up
GUI = true --GUI temperature gauge
|
--Made by Stickmasterluke
|
originalgrip=CFrame.new(1, 0, 0, 0, 0.03, 0.02, 0, -0.008, 1, 0, 1, 0.008) --CFrame.new(0,-1.5,0)*CFrame.Angles(0,math.pi/2,0)
currentgrip=originalgrip
function waitfor(parent,name)
while true do
local child=parent:FindFirstChild(name)
if child~=nil then
return child
end
wait()
end
end
function spinsword(spintime)
delay(0,function()
for i=1, 3 do
local startspin=tick()
local endspin=startspin+spintime
while tick()<endspin do
script.Parent.Grip=currentgrip*CFrame.Angles(math.pi*2*((tick()-startspin)/spintime),0,0)
wait()
end
script.Parent.Grip=currentgrip
wait(0.2)
end
end)
end
|
-- In 'ServerScriptService', add this into a script named 'PlayerSetup'
|
local function onPlayerJoin(player)
setupPlayerStats(player)
ParticleController.SetupParticlesPlayer(player)
end
|
-- ClientRemoteProperty
-- Stephen Leitnick
-- December 20, 2021
|
local Promise = require(script.Parent.Parent.Parent.Promise)
local Signal = require(script.Parent.Parent.Parent.Signal)
local ClientRemoteSignal = require(script.Parent.ClientRemoteSignal)
local Types = require(script.Parent.Parent.Types)
|
--[=[
@param object any -- Object to remove
Removes the object from the Trove and cleans it up.
```lua
local part = Instance.new("Part")
trove:Add(part)
trove:Remove(part)
```
]=]
|
function Trove:Remove(object: any): boolean
local objects = self._objects
for i,obj in ipairs(objects) do
if obj[1] == object then
local n = #objects
objects[i] = objects[n]
objects[n] = nil
self:_cleanupObject(obj[1], obj[2])
return true
end
end
return false
end
|
-- Placeholder texture can be any roblox asset link
|
local initialTexture = ""
local RowCount = 5
local ColCount = 3
local perImageSpriteCount = RowCount * ColCount
local width = 320
local height = 200
local startIndexOffset = 11
local framesInTotal = 3
assert(numImages * RowCount * ColCount >= framesInTotal)
local animPeriod = 0.3 -- period for the whole animation, in seconds
assert(animPeriod > 0)
local curImageIdx = 0
local curSpriteIdx = 0
local fps = framesInTotal / animPeriod
local accumulatedTime = 0
local function AnimateImageSpriteSheet(dt)
accumulatedTime = math.fmod(accumulatedTime + dt, animPeriod)
curSpriteIdx = math.floor(accumulatedTime * fps) + startIndexOffset
local prevImageIndex = curImageIdx
curImageIdx = math.floor(curSpriteIdx / perImageSpriteCount)
if prevImageIndex ~= curImageIdx then
imageInstance.Image = imageAssetIDs[curImageIdx + 1]
end
local localSpriteIndex = curSpriteIdx - curImageIdx * perImageSpriteCount
local row = math.floor(localSpriteIndex / ColCount)
local col = localSpriteIndex - row * ColCount
imageInstance.ImageRectOffset = Vector2.new(col * width, row * height)
end
Animator.Connection = nil
Animator.Init = function()
Animator.Connection = game:GetService("RunService").RenderStepped:Connect(AnimateImageSpriteSheet)
end
Animator.Stop = function()
if Animator.Connection then
imageInstance.Image = initialTexture
Animator.Connection:Disconnect()
end
end
return Animator
|
--[=[
Provides a debounce function call on an operation.
@function throttle
@within throttle
@param timeoutInSeconds number
@param func function
@param throttleConfig? { leading = true; trailing = true; }
@return function
]=]
|
local function throttle(timeoutInSeconds, func, throttleConfig)
assert(type(timeoutInSeconds) == "number", "timeoutInSeconds is not a number")
assert(type(func) == "function", "func is not a function")
local throttled = ThrottledFunction.new(timeoutInSeconds, func, throttleConfig)
return function(...)
throttled:Call(...)
end
end
return throttle
|
-- @ModuleDescription Library containing other small function useful for programming.
|
local System = require(game.ReplicatedStorage.System)
local Basic = {}
Basic.Replicated = true
local CachedProperties = {}
|
--NOTICE: If converting to an AF, uncomment any of the commented codes below
|
ButtonAlert.ProximityPrompt.Triggered:Connect(function()
Events:Fire("signal",1)
ButtonAlert.Click:Play()
end)
ButtonAttack.ProximityPrompt.Triggered:Connect(function()
Events:Fire("signal",2)
ButtonAttack.Click:Play()
end)
ButtonFire.ProximityPrompt.Enabled = true
ButtonFire.ProximityPrompt.MaxActivationDistance = 5
ButtonFire.ProximityPrompt.Triggered:Connect(function()
Events:Fire("fire",1)
ButtonFire.Click:Play()
end)
ButtonCancel.ProximityPrompt.Triggered:Connect(function()
Events:Fire("signal",0)
ButtonCancel.Click:Play()
end)
ButtonTest.ProximityPrompt.Triggered:Connect(function()
Events:Fire("test")
end)
ButtonTest.ProximityPrompt.TriggerEnded:Connect(function()
Events:Fire("stoptest")
end)
|
--[[
-- Usage example
local state = red.State.new({
val = 1,
time = tick(),
nest = {
val = 123123
}
})
state:listen(function(prevState, newState)
print(prevState.val, newState.val)
end)
-- Module
local module = {}
function module.fn(_state)
_state:get('nest.val')
end
return module
]]
|
local dLib = require(script.Parent.dLib)
local Util = dLib.import('Util')
local State = {}
function State.new(initialState)
local _context = initialState or {}
local _listeners = {}
local self = {}
--self.__index = self
self.__index = function(self, key)
return _context[key] or self[key]
end
--[[local self = setmetatable({}, {
__index = function(tbl, k)
return rawget(_context, k)
end;
__newindex = function(self, k, v)
rawset(_context, k, v)
end;
})]]
function self:length()
return Util.tableLength(_context)
end
function self:get(path) -- Todo: support for nested tables
if typeof(path) == 'number' then
return _context[path] -- Return the index, if exists
end
return path == true and _context or Util.treePath(_context, path, '.')
--return key and _context[key] or (key == true and _context)
end
function self:listen(fn)
assert(typeof(fn) == 'function', 'Callback argument must be a function')
local id = Util.randomString(8) -- Unique reference ID used for unsubscribing
_listeners[id] = fn
return id
end
function self:unlisten(id)
assert(_listeners[id], 'State listener does not exist')
_listeners[id] = nil
end
function self:pushUpdates(prevState)
for _, callback in pairs(_listeners) do
pcall(callback, prevState, _context)
end
end
function self:push(a, b)
local prevState = Util.extend({}, _context)
local key = b ~= nil and a or #_context + 1
_context[key] = b ~= nil and b or a
self:pushUpdates(prevState)
return key
end
function self:reset()
_context = {}
end
function self:set(newState, value)
local prevState = Util.extend({}, _context) -- Create a local copy
if typeof(newState) == 'function' then
_context = newState(_context) or _context
elseif typeof(newState) == 'table' then
for k, v in pairs(newState) do
_context[k] = v
end
elseif typeof(newState) == 'string' then
local path = Util.split(newState, '.', true)
local res = _context
-- Go through nest until the last nest level is reached
for i, childName in ipairs(path) do
local numberIndex = tonumber(childName)
if numberIndex then
childName = numberIndex
end
if res[childName] and i ~= #path then
res = res[childName]
elseif i == #path then
-- Change the value if end of the path was reached
res[childName] = value
else
break
end
end
else
return
end
self:pushUpdates(prevState)
end
function self:remove(path)
local prevState = Util.extend({}, _context) -- Create a local copy
local treePath = Util.split(path, '.', true)
local res = _context
-- Dig through nest until the last nest level is reached
for i, childName in ipairs(treePath) do
local numberIndex = tonumber(childName)
if numberIndex then
childName = numberIndex
end
if res[childName] and i ~= #treePath then
res = res[childName]
elseif i == #treePath then
-- Remove the value if end of the path was reached
res[childName] = nil
else
break
end
end
self:pushUpdates(prevState)
end
return setmetatable({}, { __index = self })
end
return State
|
--[[
An internal method used by the reconciler to construct a new component
instance and attach it to the given virtualNode.
]]
|
function Component:__mount(reconciler, virtualNode)
if config.internalTypeChecks then
internalAssert(Type.of(self) == Type.StatefulComponentClass, "Invalid use of `__mount`")
internalAssert(Type.of(virtualNode) == Type.VirtualNode, "Expected arg #2 to be of type VirtualNode")
end
local currentElement = virtualNode.currentElement
local hostParent = virtualNode.hostParent
-- Contains all the information that we want to keep from consumers of
-- Roact, or even other parts of the codebase like the reconciler.
local internalData = {
reconciler = reconciler,
virtualNode = virtualNode,
componentClass = self,
lifecyclePhase = ComponentLifecyclePhase.Init,
pendingState = nil,
}
local instance = {
[Type] = Type.StatefulComponentInstance,
[InternalData] = internalData,
}
setmetatable(instance, self)
virtualNode.instance = instance
local props = currentElement.props
if self.defaultProps ~= nil then
props = assign({}, self.defaultProps, props)
end
instance:__validateProps(props)
instance.props = props
local newContext = assign({}, virtualNode.legacyContext)
instance._context = newContext
instance.state = assign({}, instance:__getDerivedState(instance.props, {}))
if instance.init ~= nil then
instance:init(instance.props)
assign(instance.state, instance:__getDerivedState(instance.props, instance.state))
end
-- It's possible for init() to redefine _context!
virtualNode.legacyContext = instance._context
internalData.lifecyclePhase = ComponentLifecyclePhase.Render
local renderResult = instance:render()
internalData.lifecyclePhase = ComponentLifecyclePhase.ReconcileChildren
reconciler.updateVirtualNodeWithRenderResult(virtualNode, hostParent, renderResult)
if instance.didMount ~= nil then
internalData.lifecyclePhase = ComponentLifecyclePhase.DidMount
instance:didMount()
end
if internalData.pendingState ~= nil then
-- __update will handle pendingState, so we don't pass any new element or state
instance:__update(nil, nil)
end
internalData.lifecyclePhase = ComponentLifecyclePhase.Idle
end
|
-- TODO: Remove when we figure out ContextActionService without sinking keys
|
local function onShiftInputBegan(inputObject, isProcessed)
if isProcessed then return end
if inputObject.UserInputType == Enum.UserInputType.Keyboard and
(inputObject.KeyCode == Enum.KeyCode.LeftShift or inputObject.KeyCode == Enum.KeyCode.RightShift) then
--
mouseLockSwitchFunc()
end
end
local function enableShiftLock()
IsShiftLockMode = isShiftLockMode()
if IsShiftLockMode then
if ShiftLockIcon then
ShiftLockIcon.Visible = true
end
if IsShiftLocked then
Mouse.Icon = SHIFT_LOCK_CURSOR
ShiftLockController.OnShiftLockToggled:Fire()
end
if not IsActionBound then
InputCn = UserInputService.InputBegan:connect(onShiftInputBegan)
IsActionBound = true
end
end
end
GameSettings.Changed:connect(function(property)
if property == 'ControlMode' then
if GameSettings.ControlMode == Enum.ControlMode.MouseLockSwitch then
enableShiftLock()
else
disableShiftLock()
end
elseif property == 'ComputerMovementMode' then
if GameSettings.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove then
disableShiftLock()
else
enableShiftLock()
end
end
end)
LocalPlayer.Changed:connect(function(property)
if property == 'DevEnableMouseLock' then
if LocalPlayer.DevEnableMouseLock then
enableShiftLock()
else
disableShiftLock()
end
elseif property == 'DevComputerMovementMode' then
if LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.ClickToMove or
LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.Scriptable then
--
disableShiftLock()
else
enableShiftLock()
end
end
end)
LocalPlayer.CharacterAdded:connect(function(character)
-- we need to recreate guis on character load
if not UserInputService.TouchEnabled then
initialize()
end
end)
|
-------------------------
|
mouse.KeyDown:connect(function (key)
key = string.lower(key)
if key == "c" then --Camera controls
if cam == ("car") then
Camera.CameraSubject = player.Character.Humanoid
Camera.CameraType = ("Custom")
cam = ("freeplr")
Camera.FieldOfView = 70
limitButton.Text = "Free Camera"
wait(3)
limitButton.Text = ""
elseif cam == ("freeplr") then
Camera.CameraSubject = player.Character.Humanoid
Camera.CameraType = ("Attach")
cam = ("lockplr")
Camera.FieldOfView = 45
limitButton.Text = "FPV Camera"
wait(3)
limitButton.Text = ""
elseif cam == ("lockplr") then
Camera.CameraSubject = carSeat
Camera.CameraType = ("Custom")
cam = ("car")
Camera.FieldOfView = 70
limitButton.Text = "Standard Camera"
wait(3)
limitButton.Text = ""
end
end
end)
|
--// Bullet Physics
|
BulletPhysics = Vector3.new(0,55,0); -- Drop fixation: Lower number = more drop
BulletSpeed = 2500; -- Bullet Speed
BulletSpread = 0; -- How much spread the bullet has
ExploPhysics = Vector3.new(0,20,0); -- Drop for explosive rounds
ExploSpeed = 600; -- Speed for explosive rounds
BulletDecay = 10000; -- How far the bullet travels before slowing down and being deleted (BUGGY)
|
-- //
-- Luau sorta handles this now.
-- math.randomseed(os.time())
-- //
| |
--[[Weld functions]]
|
local JS = game:GetService("JointsService")
local PGS_ON = workspace:PGSIsEnabled()
function MakeWeld(x,y,type,s)
if type==nil then type="Weld" end
local W=Instance.new(type,x)
W.Part0=x W.Part1=y
W.C0=x.CFrame:inverse()*x.CFrame
W.C1=y.CFrame:inverse()*x.CFrame
if type=="Motor" and s~=nil then
W.MaxVelocity=s
end
return W
end
function ModelWeld(a,b)
if a:IsA("BasePart") then
MakeWeld(b,a,"Weld")
for i,v in pairs(a:GetChildren()) do
if v ~= nil and v:IsA("BasePart") then
ModelWeld(v,b)
end
end
elseif a:IsA("Model") then
for i,v in pairs(a:GetChildren()) do
ModelWeld(v,b)
end
end
end
function UnAnchor(a)
if a:IsA("BasePart") then a.Anchored=false end for i,v in pairs(a:GetChildren()) do UnAnchor(v) end
end
|
--[[
references:
https://create.roblox.com/docs/reference/engine/datatypes/Vector3
https://denisrizov.com/2016/06/02/bezier-curves-unity-package-included/
--]]
|
local SETTINGS = {
Debug = false
}
local function lerp(a: Vector3, b: Vector3, t)
return a:Lerp(b, t)
end
local function newInstance(class, properties)
local instance = Instance.new(class)
properties = properties or {}
for k, v in properties do
if k ~= "Parent" then
instance[k] = v
end
end
instance.Parent = properties.Parent
return instance
end
|
-- Nice getter for aspect ratio. Due to the checks in the ViewSize functions this
-- will never fail with a divide by zero error.
|
function ScreenSpace.AspectRatio()
return ScreenSpace.ViewSizeX() / ScreenSpace.ViewSizeY()
end
|
--Place this button and the model you want to regen in the same model.
|
model = script.Parent.Parent["Regen"] -- Change "Regen" to the name of your model.
newmodel = model:clone()
enabled = true
function onClicked()
if enabled then
enabled = false--Keeps you from regening the model while it's still regening
script.Parent.BrickColor = BrickColor.new(26)--Turns the button Black to let players know it is disabled
model:remove()
wait(0.1) -- This is how long it will take to regen
model = newmodel:clone()
model.Parent = script.Parent.Parent
model:MakeJoints()
wait(15) -- This is how long it will take for the regen button to be enabled after being used
script.Parent.BrickColor = BrickColor.new(23)--Turns the button Blue to tell players it is enabled
enabled = true
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- SolarCrane
|
local MAX_TWEEN_RATE = 2.8 -- per second
local function clamp(low, high, num)
return (num > high and high or num < low and low or num)
end
local math_floor = math.floor
local function Round(num, places)
local decimalPivot = 10^places
return math_floor(num * decimalPivot + 0.5) / decimalPivot
end
local function CreateTransparencyController()
local module = {}
local LastUpdate = tick()
local TransparencyDirty = false
local Enabled = false
local LastTransparency = nil
local DescendantAddedConn, DescendantRemovingConn = nil, nil
local ToolDescendantAddedConns = {}
local ToolDescendantRemovingConns = {}
local CachedParts = {}
local function HasToolAncestor(object)
if object.Parent == nil then return false end
return object.Parent:IsA('Tool') or HasToolAncestor(object.Parent)
end
local function IsValidPartToModify(part)
if part:IsA('BasePart') or part:IsA('Decal') then
return not HasToolAncestor(part)
end
return false
end
local function CachePartsRecursive(object)
if object then
if IsValidPartToModify(object) then
CachedParts[object] = true
TransparencyDirty = true
end
for _, child in pairs(object:GetChildren()) do
CachePartsRecursive(child)
end
end
end
local function TeardownTransparency()
for child, _ in pairs(CachedParts) do
child.LocalTransparencyModifier = 0
end
CachedParts = {}
TransparencyDirty = true
LastTransparency = nil
if DescendantAddedConn then
DescendantAddedConn:disconnect()
DescendantAddedConn = nil
end
if DescendantRemovingConn then
DescendantRemovingConn:disconnect()
DescendantRemovingConn = nil
end
for object, conn in pairs(ToolDescendantAddedConns) do
conn:disconnect()
ToolDescendantAddedConns[object] = nil
end
for object, conn in pairs(ToolDescendantRemovingConns) do
conn:disconnect()
ToolDescendantRemovingConns[object] = nil
end
end
local function SetupTransparency(character)
TeardownTransparency()
if DescendantAddedConn then DescendantAddedConn:disconnect() end
DescendantAddedConn = character.DescendantAdded:connect(function(object)
-- This is a part we want to invisify
if IsValidPartToModify(object) then
CachedParts[object] = true
TransparencyDirty = true
-- There is now a tool under the character
elseif object:IsA('Tool') then
if ToolDescendantAddedConns[object] then ToolDescendantAddedConns[object]:disconnect() end
ToolDescendantAddedConns[object] = object.DescendantAdded:connect(function(toolChild)
CachedParts[toolChild] = nil
if toolChild:IsA('BasePart') or toolChild:IsA('Decal') then
-- Reset the transparency
toolChild.LocalTransparencyModifier = 0
end
end)
if ToolDescendantRemovingConns[object] then ToolDescendantRemovingConns[object]:disconnect() end
ToolDescendantRemovingConns[object] = object.DescendantRemoving:connect(function(formerToolChild)
task.wait() -- wait for new parent
if character and formerToolChild and formerToolChild:IsDescendantOf(character) then
if IsValidPartToModify(formerToolChild) then
CachedParts[formerToolChild] = true
TransparencyDirty = true
end
end
end)
end
end)
if DescendantRemovingConn then DescendantRemovingConn:disconnect() end
DescendantRemovingConn = character.DescendantRemoving:connect(function(object)
if CachedParts[object] then
CachedParts[object] = nil
-- Reset the transparency
object.LocalTransparencyModifier = 0
end
end)
CachePartsRecursive(character)
end
function module:SetEnabled(newState)
if Enabled ~= newState then
Enabled = newState
self:Update()
end
end
function module:SetSubject(subject)
local character = nil
if subject and subject:IsA("Humanoid") then
character = subject.Parent
end
if subject and subject:IsA("VehicleSeat") and subject.Occupant then
character = subject.Occupant.Parent
end
if character then
SetupTransparency(character)
else
TeardownTransparency()
end
end
function module:Update()
local instant = false
local now = tick()
local currentCamera = workspace.CurrentCamera
if currentCamera then
local transparency = 0
if not Enabled then
instant = true
else
local distance = (currentCamera.Focus.p - currentCamera.CoordinateFrame.p).magnitude
transparency = (7 - distance) / 5
if transparency < 0.5 then
transparency = 0
end
if LastTransparency then
local deltaTransparency = transparency - LastTransparency
-- Don't tween transparency if it is instant or your character was fully invisible last frame
if not instant and transparency < 1 and LastTransparency < 0.95 then
local maxDelta = MAX_TWEEN_RATE * (now - LastUpdate)
deltaTransparency = clamp(-maxDelta, maxDelta, deltaTransparency)
end
transparency = LastTransparency + deltaTransparency
else
TransparencyDirty = true
end
transparency = clamp(0, 1, Round(transparency, 2))
end
if TransparencyDirty or LastTransparency ~= transparency then
for child, _ in pairs(CachedParts) do
child.LocalTransparencyModifier = transparency
end
TransparencyDirty = false
LastTransparency = transparency
end
end
LastUpdate = now
end
return module
end
return CreateTransparencyController
|
--[[
Returns the Plant Id associated with a given Seed Id
--]]
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local getAttribute = require(ReplicatedStorage.Source.Utility.getAttribute)
local Attribute = require(ReplicatedStorage.Source.SharedConstants.Attribute)
local getItemByIdInCategory = require(ReplicatedStorage.Source.Utility.Farm.getItemByIdInCategory)
local ItemCategory = require(ReplicatedStorage.Source.SharedConstants.ItemCategory)
local function getPlantIdFromSeedId(seedId: string)
local seedModel = getItemByIdInCategory(seedId, ItemCategory.Seeds)
return getAttribute(seedModel, Attribute.PlantId)
end
return getPlantIdFromSeedId
|
--[[Brakes]]
|
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 800 -- Front brake force
Tune.RBrakeForce = 1000 -- Rear brake force
Tune.PBrakeForce = 2250 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
--LIGHTING FUNCTIONS
|
script.Parent.OnServerEvent:connect(function(pl,n) if lt~=1 then pr = true else pr=false end lt=n
if lt == 0 then
RefMt.DesiredAngle = RefMt.CurrentAngle%math.rad(360)
RefMt.CurrentAngle = RefMt.CurrentAngle%math.rad(360)
UpdateLt(1,white)
UpdatePt(false,white)
StopMt(pr)
repeat wait() until lt~=0
elseif lt == 1 then
wait(.125)
RefMt.DesiredAngle = RefMt.CurrentAngle%math.rad(360)
RefMt.CurrentAngle = RefMt.CurrentAngle%math.rad(360)
UpdateLt(.25,red)
UpdatePt(true,red)
UpdateMt(0,math.rad(225),4)
wait(.75)
repeat
UpdateMt(0,math.rad(135),0)
wait(.5)
if lt~=1 then break end
UpdateMt(0,math.rad(225),0)
wait(.5)
until lt~=1
elseif lt == 2 then
UpdateLt(.25,amber)
UpdatePt(true,amber)
UpdateMt(0,9e9,1)
repeat
if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 90 then UpdateLt(.25,red) end
if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 90 then UpdatePt(true,red) end
if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 270 then UpdateLt(.25,amber) end
if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 270 then UpdatePt(true,amber) end
wait()
until lt~=2
elseif lt == 3 then
wait(1/6)
UpdateLt(.25,blue)
UpdatePt(true,blue)
UpdateMt(0,9e9,1)
repeat wait() until lt~=3
end
end)
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================
|
local function statusChanged()
local raceStatus = RaceManager:GetRaceStatus()
GameStatus.Text = raceStatus
-- Hide GUI when round is in session and player is a speeder
if raceStatus == RaceManager.Status.RoundInProgress then
StatusBar.Visible = false
else
StatusBar.Visible = true
end
end -- statusChanged()
|
--[=[
Returns whether or not the promise is fulfilled
@return bool -- True if fulfilled
]=]
|
function Promise:IsFulfilled()
return self._fulfilled ~= nil
end
|
-- in the mainUI
|
closeButton.MouseButton1Down:Connect(function()
topbar_closeButton_p:Play()
hideMainWindow()
end)
closeButton.MouseButton1Up:Connect(function()
topbar_closeButton_f:Cancel()
topbar_closebutton_r:Play()
topbar_closebutton_r.Completed:Wait()
topbar_closeButton_nf:Play()
end)
|
--wait(WaitTime)
|
local Finished = 0
local AF = 0
for l,i in pairs(Edit) do
AF = AF+1
Spawn(function()
for j, v in pairs(i) do
wait(v[3] and v[3] or 0)
for k = 1, v[2] do
for m, n in pairs(Parts:GetChildren()) do
if n.Name == l then
|
-------------------------------------------------------
--Start Important Functions--
-------------------------------------------------------
|
s.Size = Vector3.new(4, 0.05, 4)
function swait(num)
if num == 0 or num == nil then
game:service("RunService").Stepped:wait(0)
else
for i = 0, num do
game:service("RunService").Stepped:wait(0)
end
end
end
wait(1)
coroutine.resume(coroutine.create(function()
for i = 1,25 do
swait(0)
s.Size = s.Size - Vector3.new(0.04,0,0.04)
end
s:Destroy()
end))
|
--Get existing seats
|
for _ , seat in pairs(CollectionService:GetTagged(SeatTag)) do
Seats[seat] = seat
end
|
--navyblue 13
|
if k == "n" and ibo.Value==true then
bin.Blade.BrickColor = BrickColor.new("Navy blue")
bin.Blade2.BrickColor = BrickColor.new("Institutional white")
bin.Blade.White.Enabled=false colorbin.white.Value = false
bin.Blade.Blue.Enabled=false colorbin.blue.Value = false
bin.Blade.Green.Enabled=false colorbin.green.Value = false
bin.Blade.Magenta.Enabled=false colorbin.magenta.Value = false
bin.Blade.Orange.Enabled=false colorbin.orange.Value = false
bin.Blade.Viridian.Enabled=false colorbin.viridian.Value = false
bin.Blade.Violet.Enabled=false colorbin.violet.Value = false
bin.Blade.Red.Enabled=false colorbin.red.Value = false
bin.Blade.Silver.Enabled=false colorbin.silver.Value = false
bin.Blade.Black.Enabled=false colorbin.black.Value = false
bin.Blade.NavyBlue.Enabled=true colorbin.navyblue.Value = true
bin.Blade.Yellow.Enabled=false colorbin.yellow.Value = false
bin.Blade.Cyan.Enabled=false colorbin.cyan.Value = false
end
end
function bladeupdate()
if ibo.Value == true then
if idb.Value == true then
bin.Blade.Transparency = 0.4
bin.Blade2.Transparency = 0
else
bin.Blade.Transparency = 0.4
bin.Blade2.Transparency = 0
end
else
bin.Blade.Transparency = 1
bin.Blade2.Transparency = 1
bin.Blade.White.Enabled=false
bin.Blade.Red.Enabled=false
bin.Blade.Blue.Enabled=false
bin.Blade.Green.Enabled=false
bin.Blade.Magenta.Enabled=false
bin.Blade.Orange.Enabled=false
bin.Blade.Viridian.Enabled=false
bin.Blade.Violet.Enabled=false
bin.Blade.Silver.Enabled=false
bin.Blade.Black.Enabled=false
bin.Blade.NavyBlue.Enabled=false
bin.Blade.Yellow.Enabled=false
bin.Blade.Cyan.Enabled=false
end
end
function bladeupdate2()
if colorbin.white.Value==true and ibo.Value==true then bin.Blade.White.Enabled=true
end
if colorbin.red.Value==true and ibo.Value==true then bin.Blade.Red.Enabled=true
end
if colorbin.blue.Value==true and ibo.Value==true then bin.Blade.Blue.Enabled=true
end
if colorbin.green.Value==true and ibo.Value==true then bin.Blade.Green.Enabled=true
end
if colorbin.magenta.Value==true and ibo.Value==true then bin.Blade.Magenta.Enabled=true
end
if colorbin.orange.Value==true and ibo.Value==true then bin.Blade.Orange.Enabled=true
end
if colorbin.viridian.Value==true and ibo.Value==true then bin.Blade.Viridian.Enabled=true
end
if colorbin.violet.Value==true and ibo.Value==true then bin.Blade.Violet.Enabled=true
end
if colorbin.silver.Value==true and ibo.Value==true then bin.Blade.Silver.Enabled=true
end
if colorbin.black.Value==true and ibo.Value==true then bin.Blade.Black.Enabled=true
end
if colorbin.navyblue.Value==true and ibo.Value==true then bin.Blade.NavyBlue.Enabled=true
end
if colorbin.yellow.Value==true and ibo.Value==true then bin.Blade.Yellow.Enabled=true
end
if colorbin.cyan.Value==true and ibo.Value==true then bin.Blade.Cyan.Enabled=true
end
end
function onEquippedLocal(mouse)
loop.Volume = 0.5
if mouse == nil then
print("Mouse not found")
return
end
mouse.Icon = "rbxasset://textures\\GunCursor.png"
con = mouse.Button1Down:connect(function() onButton1Down(mouse) end)
con2 = mouse.KeyDown:connect(onkd)
end
function onUnequippedLocal(mouse)
loop.Volume = 0
end
Tool.Unequipped:connect(onUnequippedLocal)
Tool.Equipped:connect(onEquippedLocal)
if con ~= nil then con:disconnect() end
if con2 ~= nil then con2:disconnect() end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.