You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I am making a weapons system and i have the weapon being attached to the torso, it works fine when i spawn in, but when i equip and then unequip then the motor6d is not in the right position.
- What is the issue? Include screenshots / videos if possible!
The weapon when i spawn in:
The weapon when its equipping and unequipping:
My motor6d:
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yes i looked on the developer forums but there was nothing like this.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
my local script:
--||Services||--
local RS = game:GetService("ReplicatedStorage")
local UIS = game:GetService("UserInputService")
--||Folders||--
local Events = RS.Events
--||Events||--
local WeaponsEvent = Events.WeaponsEvent
-----------------------------------------------------------------------------------------
UIS.InputEnded:Connect(function(input, isTyping)
if isTyping then return end
if input.KeyCode == Enum.KeyCode.One then
WeaponsEvent:FireServer("Equip/Unequip")
end
end)
my server script:
--||Services||--
local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
--||Folders||--
local Models = RS.Models
local Weapons = Models.Weapons
local WeaponsWelds = script.Welds.Weapons
local Events = RS.Events
local AnimationsFolder = RS.Animations
local WeaponsAnimations = AnimationsFolder.Weapons
--||Events||--
local WeaponsEvent = Events.WeaponsEvent
--||Objects||--
local Welds = {}
--||Animations||--
local EquipAnims = {}
local UnequipAnims = {}
local IdleAnims = {}
--||Values||--
local EquipDebounce = {}
-----------------------------------------------------------------------------------------
Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local torso = char.Torso
--
char:SetAttribute("Equipped", false)
--
local Weapon = Weapons.Sabre
Weapons.Parent = char
Welds[plr] = WeaponsWelds.Sabre.IdleWeaponWeld:Clone()
Welds[plr].Parent = torso
Welds[plr].Part0 = torso
Welds[plr].Part1 = Weapon
end)
end)
Players.PlayerRemoving:Connect(function(plr)
if Welds[plr] then
table.remove(Welds, table.find(Welds, Welds[plr]))
end
end)
--
WeaponsEvent.OnServerEvent:Connect(function(plr, action)
local char = plr.Character
local hum = char:WaitForChild("Humanoid")
local torso = char.Torso
local rightArm = char["Right Arm"]
--
if action == "Equip/Unequip" and not char:GetAttribute("Equipped") and not EquipDebounce[plr] then -- Equipping the weapon
EquipDebounce[plr] = true
IdleAnims[plr] = hum.Animator:LoadAnimation(WeaponsAnimations.Sabre.Main.Idle)
EquipAnims[plr] = hum.Animator:LoadAnimation(WeaponsAnimations.Sabre.Main.Equip)
EquipAnims[plr]:Play()
EquipAnims[plr]:GetMarkerReachedSignal("Weld"):Connect(function()
Welds[plr].Part0 = rightArm
Welds[plr].C1 = WeaponsWelds.Sabre.HoldingWeaponWeld.C1
end)
EquipAnims[plr]:GetMarkerReachedSignal("Equipped"):Connect(function()
IdleAnims[plr]:Play()
char:SetAttribute("Equipped", true)
EquipDebounce[plr] = false
end)
elseif action == "Equip/Unequip" and char:GetAttribute("Equipped") then -- Unequipping the weapon
EquipDebounce[plr] = true
IdleAnims[plr]:Stop()
UnequipAnims[plr] = hum.Animator:LoadAnimation(WeaponsAnimations.Sabre.Main.Unequip)
UnequipAnims[plr]:Play()
UnequipAnims[plr]:GetMarkerReachedSignal("Weld"):Connect(function()
Welds[plr].Part0 = torso
Welds[plr].C1 = WeaponsWelds.Sabre.IdleWeaponWeld.C1
end)
UnequipAnims[plr]:GetMarkerReachedSignal("Unequipped"):Connect(function()
char:SetAttribute("Equipped", false)
EquipDebounce[plr] = false
end)
end
end)
It is probably clear that i dont know much about motor6d weapons. Help is appreciated!