New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Is it better to get the position of the tool from a serverscript or from a local scr?ipt read desc

Asked by 11 days ago

Im trying to get the position of a tool which is a handle

I was wondering if I should fireServer the tools handle position

or just check it in a server

for example

Remote:FireServer(Handle.Position)



or just do it from the server

local Tool = game.Workspace[player.Name]FindFirstChildWhichIsA('Tool')

1 answer

Log in to vote
0
Answered by
thebayou 391 Moderation Voter
11 days ago

Both are perfectly valid ways of getting the tool's position on the server.

There are other ways too. For example, if you create a script inside the tool itself, you could do:

local tool = script.Parent
local position = tool.Handle.Position

-- Do stuff with position in script

Each approach has its pros and cons.

Remote event pros:

  • Easier to handle multiple different tools
  • Client has control over when to fire the RE/activate the tool
  • The behavior associated with the tool is in one place, so it's easier to change and more consistent

Cons:

  • Slight latency, since the event has to get fired by the client and go through to the server
  • Program flow might not be intuitive depending on the context of the problem

Server-side (the one in your question) pros:

  • Simple, direct access to tool and its position

Cons:

  • Harder to handle if the player owns many tools. Not only do you have to find the tool, but you have to make sure the tool is the right tool

So with those considerations in mind, it is completely up to you to decide which approach to go with. Depending on the situation, any of the approaches might work. Good luck!

Ad

Answer this question