In short, I’m a big fan of a mobile game called “Dancing Line” and I’m trying to recreate something similar on Roblox and I’m getting a good result, but something that’s bothering me is that the corners of the line always look a little weird when I play.
Demo gameplay:
The problem:
As you can see, the corners look weird and I’ve tried several ways but I haven’t been able to fix them. Can anyone tell me what it could be?
Movement script I made:
local RunService = game:GetService("RunService")
local Debris = game:GetService("Debris")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid: Humanoid = character:WaitForChild("Humanoid")
local hrp: BasePart = character:WaitForChild("HumanoidRootPart")
local gui = script.Parent
local line = gui.LinePart
local text = gui.Text
local move = gui.Move
local idle = true
local lineEnabled = true
local direction: string = nil
local left = Vector3.new(0, 0, -2048)
local right = Vector3.new(-2048, 0, 0)
local currentLine = nil
local lastPosition = nil
local lineFolder = workspace:FindFirstChild("Line")
if not lineFolder then
lineFolder = Instance.new("Folder")
lineFolder.Name = "Line"
lineFolder.Parent = workspace
end
function NewLine()
local newLine = line:Clone()
newLine.Position = hrp.Position
newLine.Parent = lineFolder
Debris:AddItem(newLine, 16)
return newLine
end
function Move(to: string)
lastPosition = hrp.Position
if to == "Left" then
direction = "Left"
humanoid:MoveTo(hrp.Position + left)
currentLine = NewLine()
elseif to == "Right" then
direction = "Right"
humanoid:MoveTo(hrp.Position + right)
currentLine = NewLine()
end
end
move.Pressed:Connect(function()
if idle then
idle = false
text:Destroy()
Move("Left")
return
end
if direction == "Left" then
Move("Right")
else
Move("Left")
end
end)
humanoid.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Freefall then
lineEnabled = false
elseif newState == Enum.HumanoidStateType.Landed then
lineEnabled = true
Move(direction)
end
end)
RunService.Stepped:Connect(function()
if not idle and lineEnabled then
if currentLine then
currentLine.Position = lastPosition:Lerp(hrp.Position, 0.5)
if direction == "Left" then
currentLine.Size = Vector3.new(2, 2, (hrp.Position - lastPosition).Magnitude + 2)
else
currentLine.Size = Vector3.new((hrp.Position - lastPosition).Magnitude + 2, 2, 2)
end
end
end
end)
Thank you to everyone who tries to help! <3