Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[--
- Made by Farhat and Pio with love.
- Compiled with Gemini AI lol to make this perfect script.
- --]]--
- --!optimize 2
- --!native
- if not game:IsLoaded() then game.Loaded:Wait() end
- local function missing(t: string, f: any, fallback: any): any
- if type(f) == t then
- return f
- end
- return fallback
- end
- local cloneref = missing("function", cloneref, function(...)
- return ...
- end)
- local setscriptable = missing("function", setscriptable or set_scriptable, function(...)
- return ...
- end)
- local isscriptable = missing("function", isscriptable or is_scriptable, function(...)
- return false
- end)
- local sethidden = missing("function", sethiddenproperty or set_hidden_property or set_hidden_prop, function(obj, prop, arg)
- if isscriptable(obj, prop) == false then
- setscriptable(obj, prop, true)
- obj[prop] = arg
- setscriptable(obj, prop, false)
- else
- obj[prop] = arg
- end
- end)
- local gethidden = missing("function", gethiddenproperty or get_hidden_property or get_hidden_prop, function(obj, prop)
- if isscriptable(obj, prop) == false then
- setscriptable(obj, prop, true)
- local val = obj[prop]
- setscriptable(obj, prop, false)
- return val, true
- else
- return obj[prop], isscriptable(obj, prop)
- end
- end)
- local getgenv = missing("function", getgenv or get_genv, function()
- if _G then
- return _G
- elseif shared then
- return shared
- else
- return {}
- end
- end)
- local Services = setmetatable({}, {
- __index = function(self, name: string)
- local success, cache = pcall(function()
- return cloneref(game:GetService(name))
- end)
- if success then
- rawset(self, name, cache)
- return cache
- else
- error("Invalid Service: " .. tostring(name))
- end
- end,
- })
- -- getgenv()["ppsetings"] = {["colorA"] = "yellow", ["colorB"] = "black", ["vsize"] = Vector3.new(1, 6, 1) * 1}
- local colorA = getgenv()["ppsetings"]["colorA"] or "yellow"
- local colorB = getgenv()["ppsetings"]["colorB"] or "black"
- local vsize = getgenv()["ppsetings"]["vsize"] or Vector3.new(1, 6, 1) * 1
- local ReplicatedStorage: ReplicatedStorage = Services.ReplicatedStorage
- local Players: Players = Services.Players
- local UserInputService: UserInputService = Services.UserInputService
- local RunService: RunService = Services.RunService
- local PreSimulation = RunService.PreSimulation
- local PostSimulation = RunService.PostSimulation
- local LocalPlayer: Player = Players.LocalPlayer
- local mouse = LocalPlayer:GetMouse()
- local event_generation = ReplicatedStorage:WaitForChild("event_generation")
- local EventDoneGeneration = ReplicatedStorage:WaitForChild("event_done_generation")
- local prompt = "Create exactly 4 parts and nothing else:\n\nTwo " .. colorA .. " spheres, small, side by side on the ground.\nOne " .. colorA .. " upright cylinder, height: tall, width: normal, centered above the two spheres and resting on them.\nOne " .. colorB .. " small sphere, centered on top of the cylinder and overlapping/intersecting it.\n\nNo extra parts.\n"
- local generationSuccess = false
- for attempt = 1, 5 do
- local done = false
- local successResult = false
- EventDoneGeneration.OnClientEvent:Once(function(a1)
- successResult = a1 == true
- done = true
- end)
- event_generation:FireServer(prompt, vsize)
- while not done do
- task.wait()
- end
- if successResult then
- print("Generation Complete.")
- generationSuccess = true
- break
- else
- print("Generation Failed. Retry " .. tostring(attempt) .. "/5")
- task.wait(0.5)
- end
- end
- if not generationSuccess then
- warn("Generation failed after 5 attempts, maybe try again? If not then report this bug on Discord.")
- return
- end
- local TARGET_USERNAME = LocalPlayer.Name
- local TAIL_LENGTH: number
- local TAIL_WIDTH: number
- if vsize == Vector3.new(1, 6, 1) * 0.5 then
- TAIL_LENGTH = 2
- TAIL_WIDTH = 0.5
- else
- TAIL_LENGTH = 4
- TAIL_WIDTH = 0.75
- end
- local TAIL_COLOR = Color3.fromRGB(45, 45, 45)
- local FORWARD_OFFSET = TAIL_LENGTH * 1
- local UP_OFFSET = TAIL_LENGTH * -2
- local RAISED_UP_OFFSET = TAIL_LENGTH * 0.6
- local SPRING_STIFFNESS = 140 * (TAIL_LENGTH / 3.0)
- local SPRING_DAMPING = 5 * (TAIL_LENGTH / 5.0)
- local MAX_CONE_ANGLE = 50
- local POLE_STIFFNESS = 600 * (TAIL_LENGTH / 5.0)
- local POLE_DAMPING = 30 * (TAIL_LENGTH / 5.0)
- local function attachTail(char: Model)
- if not char then
- return
- end
- local torso = char:FindFirstChild("LowerTorso") or char:FindFirstChild("Torso")
- if not torso or not torso:IsA("BasePart") then
- return
- end
- local rootPart = char:FindFirstChild("HumanoidRootPart")
- if not rootPart or not rootPart:IsA("BasePart") then
- return
- end
- local existingTail = char:FindFirstChild("ProceduralTail")
- if existingTail then
- existingTail:Destroy()
- end
- local folder = Instance.new("Folder")
- folder.Name = "ProceduralTail"
- folder.Parent = char
- local jointOffset = Vector3.new(0, -torso.Size.Y / 4 - 0.2, -torso.Size.Z / 2 + 0.25)
- local tail = Instance.new("Part")
- tail.Name = "SingleTailSegment"
- tail.Size = Vector3.new(TAIL_WIDTH, TAIL_WIDTH, TAIL_LENGTH)
- tail.Color = TAIL_COLOR
- tail.Material = Enum.Material.SmoothPlastic
- tail.Massless = false
- tail.CanCollide = true
- tail.CustomPhysicalProperties = PhysicalProperties.new(0.6, 0.3, 0.5)
- tail.CFrame = torso.CFrame * CFrame.new(jointOffset - Vector3.new(0, 0, TAIL_LENGTH / 2))
- tail.Transparency = 0.5
- tail.Parent = folder
- sethidden(tail, "NetworkIsSleeping", false)
- local function noCollideWith(part: BasePart)
- local nc = Instance.new("NoCollisionConstraint")
- nc.Part0 = tail
- nc.Part1 = part
- nc.Parent = folder
- end
- for _, part in ipairs(char:GetDescendants()) do
- if part:IsA("BasePart") and part ~= tail then
- noCollideWith(part)
- end
- end
- char.DescendantAdded:Connect(function(part)
- if part:IsA("BasePart") and part ~= tail then
- noCollideWith(part)
- end
- end)
- local att0 = Instance.new("Attachment")
- att0.Position = jointOffset
- att0.Axis = Vector3.new(0, 0, -1)
- att0.Parent = torso
- local att1 = Instance.new("Attachment")
- att1.Position = Vector3.new(0, 0, TAIL_LENGTH / 2)
- att1.Axis = Vector3.new(0, 0, -1)
- att1.Parent = tail
- local joint = Instance.new("BallSocketConstraint")
- joint.Attachment0 = att0
- joint.Attachment1 = att1
- joint.LimitsEnabled = true
- joint.UpperAngle = MAX_CONE_ANGLE
- joint.TwistLimitsEnabled = true
- joint.TwistLowerAngle = 0
- joint.TwistUpperAngle = 0
- joint.Parent = tail
- local springAtt0 = Instance.new("Attachment")
- springAtt0.Position = jointOffset + Vector3.new(0, UP_OFFSET, -FORWARD_OFFSET)
- springAtt0.Parent = torso
- local springAtt1 = Instance.new("Attachment")
- springAtt1.Position = att1.Position - Vector3.new(0, 0, FORWARD_OFFSET)
- springAtt1.Parent = tail
- local spring = Instance.new("SpringConstraint")
- spring.Attachment0 = springAtt0
- spring.Attachment1 = springAtt1
- spring.FreeLength = 0
- spring.Stiffness = SPRING_STIFFNESS
- spring.Damping = SPRING_DAMPING
- spring.Parent = tail
- local tipAtt = Instance.new("Attachment")
- tipAtt.Position = Vector3.new(0, 0, -TAIL_LENGTH / 2)
- tipAtt.Parent = tail
- local rootAtt = Instance.new("Attachment")
- rootAtt.Position = Vector3.zero
- rootAtt.Parent = rootPart
- local poleSpring = Instance.new("SpringConstraint")
- poleSpring.Attachment0 = rootAtt
- poleSpring.Attachment1 = tipAtt
- poleSpring.FreeLength = TAIL_LENGTH + (TAIL_LENGTH * 0.4)
- poleSpring.Stiffness = POLE_STIFFNESS
- poleSpring.Damping = POLE_DAMPING
- poleSpring.Parent = folder
- local baseUpOffset = UP_OFFSET
- local sideOffset = 0
- local fHeld = false
- local function getBasePos(): Vector3
- return Vector3.new(jointOffset.X + sideOffset, baseUpOffset, jointOffset.Z - FORWARD_OFFSET)
- end
- local inputBegan = UserInputService.InputBegan:Connect(function(input, gameProcessed)
- if gameProcessed then
- return
- end
- if input.KeyCode == Enum.KeyCode.T then
- baseUpOffset = RAISED_UP_OFFSET
- springAtt0.Position = getBasePos()
- elseif input.KeyCode == Enum.KeyCode.F then
- fHeld = true
- end
- end)
- local inputEnded = UserInputService.InputEnded:Connect(function(input)
- if input.KeyCode == Enum.KeyCode.T then
- baseUpOffset = UP_OFFSET
- springAtt0.Position = getBasePos()
- elseif input.KeyCode == Enum.KeyCode.F then
- fHeld = false
- sideOffset = 0
- baseUpOffset = UP_OFFSET
- springAtt0.Position = getBasePos()
- end
- end)
- local heartbeat = RunService.Heartbeat:Connect(function()
- if not folder.Parent then
- return
- end
- if not fHeld then
- return
- end
- local mouseDir = (mouse.Hit.Position - torso.Position).Unit
- local localDir = torso.CFrame:VectorToObjectSpace(mouseDir)
- sideOffset = localDir.X * FORWARD_OFFSET
- baseUpOffset = localDir.Y * RAISED_UP_OFFSET
- springAtt0.Position = getBasePos()
- end)
- folder.AncestryChanged:Connect(function()
- if not folder.Parent then
- inputBegan:Disconnect()
- inputEnded:Disconnect()
- heartbeat:Disconnect()
- end
- end)
- end
- local targetPlayer = Players:FindFirstChild(TARGET_USERNAME) or Players.PlayerAdded:Wait()
- if targetPlayer.Name == TARGET_USERNAME then
- local char = targetPlayer.Character or targetPlayer.CharacterAdded:Wait()
- attachTail(char)
- end
- local TOOL_OFFSET: CFrame = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-90), 0, 0)
- local NETLESS_VELOCITY = Vector3.new(0, 30.15, 0)
- local NETLESS_MAGNITUDE = NETLESS_VELOCITY.Magnitude
- local NETLESS_MASK = Vector3.new(1, 0, 1)
- local Backpack = LocalPlayer:WaitForChild("Backpack") :: Backpack
- local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
- local Humanoid = Character:WaitForChild("Humanoid") :: Humanoid
- local function getNetlessVelocity(velocity: Vector3): Vector3
- local magnitude = velocity.Magnitude
- if magnitude > 1 and magnitude < 100 then
- local unit = velocity.Unit
- if unit.Y > 0.25 or unit.Y < -0.75 then
- return velocity * (NETLESS_MAGNITUDE / velocity.Y)
- end
- velocity = unit * 125
- end
- return (velocity * NETLESS_MASK) + NETLESS_VELOCITY
- end
- local function waitForCustomTool(): Tool
- local existingInChar = Character:FindFirstChild("custom tool")
- if existingInChar and existingInChar:IsA("Tool") then
- return existingInChar
- end
- local tool = Backpack:WaitForChild("custom tool") :: Tool
- return tool
- end
- local function stopAnimations()
- local char = LocalPlayer.Character
- local hum = char and (char:FindFirstChildOfClass("Humanoid") or char:FindFirstChildOfClass("AnimationController"))
- if not hum then
- return
- end
- for _, track in next, hum:GetPlayingAnimationTracks() do
- track:Stop()
- end
- end
- local function claimTool(tool: Tool)
- tool.Parent = Character
- task.wait(0.25)
- for _ = 1, 2 do
- tool.Parent = Character
- tool.Parent = Backpack
- end
- tool.Parent = Humanoid
- tool.Parent = Character
- stopAnimations()
- end
- if not getgenv().SimulationRadius then
- pcall(function()
- sethidden(settings().Physics, "AllowSleep", false)
- end)
- getgenv().SimulationRadius = PreSimulation:Connect(function()
- pcall(function()
- sethidden(LocalPlayer, "SimulationRadius", 9e5)
- end)
- end)
- end
- local proceduralTail = Character:WaitForChild("ProceduralTail")
- local part = proceduralTail:WaitForChild("SingleTailSegment") :: BasePart
- local tool: Tool = waitForCustomTool()
- local handle = tool:WaitForChild("Handle") :: BasePart
- claimTool(tool)
- local AttachLoop: RBXScriptConnection? = PostSimulation:Connect(function()
- handle.CFrame = part.CFrame * TOOL_OFFSET
- handle.AssemblyLinearVelocity = getNetlessVelocity(handle.AssemblyLinearVelocity)
- end)
- tool.AncestryChanged:Once(function()
- if AttachLoop then
- AttachLoop:Disconnect()
- AttachLoop = nil
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment