Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Heartbeat lags behind while in a server?

Asked by
B_Iu 31
6 years ago
Edited 6 years ago

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!

The script is located inside the sword (Single union) and the variable "player" is a textlabel in the worksapce. here it is 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)

edited because what I asked before made absolutely no sense

0
Line 6 has a capitalisation error. User#19524 175 — 6y
0
I realize that i never really capitalize Parent. I started out like that and it works so it eventually grew into a habit. I'll try to cap Parent when I script. B_Iu 31 — 6y
0
Ok User#19524 175 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

You could simply set the item inside of the character and weld it to the hand, or use the default Roblox tool and it's properties.

0
You're right about that... Is there a way I could switch the weld to a different player? I cant use a tool because it messes with reflectance. B_Iu 31 — 6y
0
You could destroy the weld, then move it and create another weld. coolboy6786543 113 — 6y
Ad

Answer this question