I have an orb that orbits around the players head
The orb is supposed to send chat bubbles too, and it works fine when the player is stationary, but when the player moves, even though the orb orbits perfectly smooth, the chat twitches a little independently of the orbs position
Code:
-- in StarterCharacterScripts
local RunService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local HRP = character:WaitForChild("Head")
local orbitPart = character:WaitForChild("OrbitPart")
orbitPart.Anchored = true
local CYCLE_DURATION = 10
local DISTANCE = 4
local i = 0
RunService.RenderStepped:Connect(function(dt)
i = (i + dt/CYCLE_DURATION) % 1
local alpha = 2 * math.pi * i
orbitPart.CFrame = CFrame.Angles(0, alpha, 0)
* CFrame.new(0, 0, DISTANCE)
+ HRP.Position
end)
task.wait(3)
while task.wait(10) do
local chat = game:GetService("Chat")
chat:Chat(orbitPart, "blabla")
end
With tweens the chat doesnt bug out but the orb moves pretty glitchly (since after all youre running a tween every frame instead of just setting the position)