I recently finished making a script that moves the limbs relative to mouse position,
and I need to carry these over to server.
What is the best way to go about this?
Any help is appreciated.
I recently finished making a script that moves the limbs relative to mouse position,
and I need to carry these over to server.
What is the best way to go about this?
Any help is appreciated.
I’ve heard of utilizing network ownership but I do not know how to use this.
Boosting post or something again lol
You can make a remote event that when fired sends CFrame value on server and then server changes limbs CFrame
Examle:
-- Client
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
while wait() do
game.ReplicatedStorage.RemoteEvent:FireServer(Mouse.Hit)
end
-- Server
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player,CF)
game.Workspace.Part.CFrame = CF
end)
Result:
Would that not be laggy or server heavy?
Boosting Post
(charlimit lols)
If you are really worried about server performance, you can send only CFrame values of limbs to the server, then the server sends all that information to the other clients, so each individual client will render the limbs where they are supposed to be.
soo, you don’t need do it in every frame to get good effect, the best thing you can do is vvhile loop that have a cooldovvn like 1/15 , this means 15 frames per secconds, i tried this vvith 20 and it’s nice and don’t lag, you can use optimization methoods to do that like doing cframe function variable , i you vvan’t to move your character , you can use either mouse.Move event, to do that
I tried this out and it works well. Any objections to this code? (mouse = getmouse, root = player.character.root, equipped = is tool equipped, aocf = remoteevent)
while task.wait(0.01) do
if mouse and equipped then
local lookToPosVector = Vector3.new(mouse.Hit.Position.X,root.CFrame.Y,mouse.Hit.Position.Z)
root.CFrame = CFrame.new(root.CFrame.p,lookToPosVector)
aocf:FireServer("mouse",{mouse.Hit,mouse.Origin,false})
end
end
Thats a good idea, I will utilize this.
Don’t use while task.wait(0.01), you can’t wait that short a time anyway the minimum is 1/30th of a second. Use RenderStepped:Connect
instead if you want to do something every frame, like for smooth animation.
Smooth animation is handled with Lerp, even if it is choppy it will still look fine.
Anyways, with task.wait(0.01)
:
I think it looks nice.
If it works for you then don’t change it, just pointing it out since you asked
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.