#Nope.exe
There is no way for you to get a server-side script to do something at 0.016 seconds without a local script. So when you're a coder you need to think of solutions for your problem. What is one solution? Well, use remote events of course! You can connect Local Scripts to Server-Sided ones, you don't have to move the parts with a local script so you can get reliable movement and its FE compatible! A win-win-win!
#Remote Event
Insert the remote event into the server script for this example. I have a local and server script. I need the local script to make a part with the player's name. How do we do that?
####Local script
local part = Instance.new("Part",workspace)
part.Name = game:GetService("Players").LocalPlayer.Name
workspace.ServerScript.RemoteEvent:FireServer()
####Server script for method 2
script.RemoteEvent.OnServerEvent(function(player)
local part = Instance.new("Part",workspace)
part.Name = player.Name
end)
#Final Product
The reason why HeartBeat is local script only is because it fires every time a frame runs on the player's computer, which is 60 frames per second, but since it depends on the client's computer speed it must be local. That's the reason why it can only be used in Local Scripts.
What I did here was I used HeartBeat inside of the local script that will fire the server every time. After it does that then the server will continuously move a model upwards.
####Local script
game:GetService("RunService").HeartBeat:connect(function()
workspace.Script.RemoteEvent:FireServer()
end)
####Server Side
script.RemoteEvent.OnServerEvent:connect(function()
workspace.Model:SetPrimaryPartCFrame(workspace.Model.PrimaryPart.CFrame*CFrame.new(0,1,0)
end)
What I would do is have the server script move and control all of the NPCs hearts at once so that all the players are controlling the heart's movements. You can also make the hearts local and turn on FE because all the players will be seeing the same thing. Just work off what I did and try to make it work, but I'd make one single server script control all of the NPCs and will move the heart behind it while the function is firing.
Hope it helps!
1 comment
If you use the parts as a 3D gui then you should reposition them from a LocalScript. Gui elements should always be handled from the clientside.