I have a weapon that i want to sheath (weld the weapon to a different part of the player) The script that manages the weapon is a localScript, accepting inputs and firing events to the server. The sheathing worked at first, but then i realized that it wasn’t replicating to the server. So i had this script on the server that accepts input from a remoteEvent to manipulate welds on the player.
local remote = game.ReplicatedStorage.ServerRemotes.Weld
remote.OnServerEvent:Connect(function(plr, weld, part1)
print(weld)
weld.Part1 = part1
end)
For some reason, with this script ^^^ the weapon seems to vanish (not just physical parts, but the entire model)
https://gyazo.com/6e2613825b96f2fe9f2ef9f822b03abf
(Yes, i know that is a diamond sword lol. It is there for testing)
Try creating a new weld at runtime (I assume you know how to weld? If not look at a weld script like Weld 2.2 search it in toolbox) instead of trying to change it (and destroy the old weld). I haven’t really worked with welds much, so I am not sure if it can be changed at runtime, but I think it can’t (but not sure).
Also, try looking into/working with WeldConstraint | Documentation - Roblox Creator Hub
2 Likes
Welds can be changed during runtime, i have done this many times before. I will attempt to create a new weld instead of manipulating the original like you said.
I enabled the collider for the handle of the weapon, and the glitch seems to have stopped.
EDIT: Sorry to bother you guys. There was a minor error in my code, it seems to work correctly now (i knew that i would be able to find the solution only after i posted this on the forum, because thats how debugging works apparently)
1 Like