Or put more code into this so I can modify it to my needs. (Preferably this one. I'm bored.)
This specific code will put a realistic tail on the player that can be controlled with the mouse's position.
The higher up the mouse is on the screen, the more straight, the lower is the more curved.
Left/Right are inverted.
Code: Select all
wait(1)
local Parts = {game.Players.LocalPlayer.Character.Torso}
local w = {}
for i = 2, 22 do
Parts[i] = Instance.new("Part", game.Players.LocalPlayer.Character)
Parts[i].BrickColor = BrickColor.Blue()
Parts[i].CanCollide = false
Parts[i].Locked = true
Parts[i].formFactor = "Symmetric"
Parts[i].Size = Vector3.new(1, 1, 1)
Mesh = Instance.new("BlockMesh", Parts[i])
Mesh.Name = "Mesh"
if i > 18 then
mult = (i-18) / 10
else
mult = 0
end
Mesh.Scale = Vector3.new((math.abs(0.4 - (i - 1) / 40)) + 0.2 + mult, 0.6 - (i - 1) / 40, 0.5)
w[i - 1] = Instance.new("Weld", Parts[i])
w[i - 1].Part0 = Parts[i - 1]
w[i - 1].Part1 = Parts[i]
w[i - 1].C0 = CFrame.new(0, 0, 0.25)
w[i - 1].C1 = CFrame.new(0, 0, -0.25)
end
w[1].C0 = CFrame.new(0, -0.75, 0.5)
function Smooth(WhereTo0, Welds)
local CR0 = CFrame.new(Welds[1].C1:toEulerAnglesXYZ()).p
local CR1 = CFrame.new(WhereTo0).p
local AddTo0 = (CR1 - CR0) / 50
for a = 1, #Welds do
Welds[a].C1 = Welds[a].C1 * CFrame.fromEulerAnglesXYZ(AddTo0.x, AddTo0.y, AddTo0.z)
end
end
local scr = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui)
local absx = scr.AbsoluteSize.X
local absy = scr.AbsoluteSize.Y
scr:Destroy()
local mouse = game.Players.LocalPlayer:GetMouse()
game:GetService("RunService").RenderStepped:connect(function ()
local r = CFrame.new(Vector3.new((mouse.Y - absy/2)/absy, (mouse.X - absx/2)/absx, 0)).p
local x = r.x
local y = r.y
local z = r.z
Smooth(Vector3.new(x, y, z), w)
end)