Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Getting newest Mouse.Hit.p with a Remote Function?

The problem is whenever I do this in a local script, it works perfectly but in a server script with a remote function it only makes the character face the mouse once and doesn't update. Is there anyway to do this?

for i = 1,math.huge do
	Player.Character.HumanoidRootPart.CFrame = CFrame.new(Player.Character.HumanoidRootPart.Position, Mouse.Hit.p)
	game:GetService('RunService').Stepped:wait()
end

1 comment

0

Nope. I had this issue too. The only way is to loop fire a remote which is a terrible idea.

1 answer

There's nothing wrong with your script being a LocalScript, even in FilteringEnabled (I tested it). Players have control over the position of their own characters (this is how movement occurs) due to NetworkOwnership.

@spinywind: Firing a RemoteEvent in a loop is not a terrible idea -- that's effectively what Roblox is doing when things on the server change (ex when a Part moves, it has to convey this to everyone else). 30 extra Vector3s/sec per player is not going to hurt anything (see next paragraph for the calculation; note that since the server only handles 30 updates per second, you needn't use Stepped:Wait() - just use wait()). You could certainly do this to "solve" the problem (but as mentioned, this is unnecessary).

The limitations on all RemoteEvents are suggested to be approximately 50 KB/sec per player (though it also recommends not going that high, if possible). A Vector3 only contains 3 doubles (the rest of its fields can be recalculated on the server), and each double is only 8 bytes. 1024 bytes/KB * 50 KB/sec divided by 8 bytes/Vector3 = 6400 Vector3s/sec, and sending Mouse.Hit.p constantly to the server is only 30 Vector3s/sec -- that's not even 0.5% of the available bandwidth!

2 comments

0

Thank you! But is there anyway to find the KB from remote events or functions?

0

You mean how much they're using? You can analyze the scripts in the same way I did above. If you can test using "Start Server" in Studio, you can also go to View > Network. However, you shouldn't need to worry about it.

This discussion is preserved as it was. New answers, comments, and votes are closed.