Hi. I'm trying to make a sword. The problem I'm having is with Roblox's Heartbeat feature, as it is lagging behind while in a server. What I'm trying to do here is constantly keep the sword's handle at the player's right hand (R15) using Heartbeat to keep the position and orientation the same as the player's right hand. It works flawlessly in studio, but when I test it in an online server it only updates around 10-15 times per second. Then i got a few people join, and it only updated around 1-5 times per second. I do believe this issue is occurring on Roblox's side. This is really confusing and I would like to know if there's a solution... Thanks!
My script is posted below:
game:GetService("RunService").Heartbeat:Connect(function()
local player = workspace.name.Text
if workspace:FindFirstChild(""..player.."") then
script.parent.Transparency = 0
script.parent.Position = workspace[""..player..""].RightHand.Position
script.parent.Orientation = workspace[""..player..""].RightHand.Orientation
else
script.parent.Transparency = 1
end
end)
