How to make a Model that is created and moved by the client show on the server

So i have a Mjolnir model that is being created and moved by a local script and im trying to make it show on the server. How do i do that?

Sorry, you can’t make a local script show Mjolnir on the server.

Quick thoughts:

1. Custom replication

  • Weapons only exist on clients and not the server, i.e. whenever a player wants to equip a weapon it informs the server who checks whether this request was valid, and then sends an event to all other players to inform them that XYZ player has equipped a weapon
  • Every player, including the one that equipped the weapon, will instantiate the weapon locally and will perform the animation that sends the hammer flying into the player’s hands
  • Any future changes / actions would be sent to the server for validation and replicated to each of the client(s)

2. Fake it

  • When the player equips the tool the server will automatically instantiate, parent & weld the hammer to the player – if you’re not using a tool you’ll have to do this manually
  • The server should ensure the weapon is invisible when it first spawns
    • It will then send an event to all players in the region of that player to play the hammer animation, i.e. each of the players, including the player equipping the weapon, will animate the hammer towards the player’s hands
    • Either (a) after set amount of time has elapsed, (b) the server calculates the appropriate time or (c) the original client confirms the hammer is in their hands by sending an event to the server → the server then makes the hammer opaque so all current & future players will see the item attached to the hand

3. Using Roblox’s replication

  • The player can be given NetworkOwnership over the weapon, which would allow it to control the weapon’s position, velocity and other associated instances e.g. AlignPosition and AlignOrientation instance(s)

  • When the player equips the weapon and performs the hammer animation:

    Note: When a player equips a weapon through a tool it is automatically given NetworkOwnership, but changes to Welds & Motors are not replicated due to safety concerns over animations; so that’s why we’re asking the server to make changes to the Weld/Motor here

    • A request is sent to the server to break and/or disable the weld between the player and the weapon and then calls SetNetworkOwner on the tool to ensure the player regains ownership
    • The player increases the MaxForce and MaxTorque properties of the AlignPosition/AlignOrientation and animates the weapon → this will be automatically replicated
    • Once the weapon is back in the player’s hands they will send another event to the server so that they will reinstantiate / enable the weld between the player and the weapon

I went on the first solution thanks!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.