-
What do you want to achieve? Keep it simple and clear!
For BodyAttach to return to the model. -
What is the issue? Include screenshots / videos if possible!
BodyAttach isn’t appearing back in the character’s Bayonet tool. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I couldn’t find anything.
Local Script Code:
local CharCheck = game:GetService("Players").LocalPlayer.Character or game:GetService("Players").LocalPlayer.CharacterAdded:Wait()
local char = game:GetService("Players").LocalPlayer.Character
local Mouse = game:GetService("Players").LocalPlayer:GetMouse()
local Animator = char:WaitForChild("Humanoid").Animator
local Enabled = false
local WeaponTool = script.Parent.Bayonet
script.Parent.Equipped:Connect(function()
game.ReplicatedStorage.ConnectM6D:FireServer(WeaponTool.BodyAttach)
char.Torso.ToolGrip.Part0 = char.Torso
char.Torso.ToolGrip.Part1 = WeaponTool.BodyAttach
Enabled = true
Mouse.Button1Down:Connect(function()
if Enabled == true then
local RandomNumber = math.random(2,2)
local AnimationToPlay = WeaponTool.AnimSaves:FindFirstChild("Stab"..RandomNumber)
Animator:LoadAnimation(AnimationToPlay):Play()
end
end)
end)
script.Parent.Unequipped:Connect(function()
Animator:LoadAnimation(WeaponTool.AnimSaves.Holster1):Play()
Animator.AnimationPlayed:Wait()
game.ReplicatedStorage.DisconnectM6D:FireServer()
end)
Server Script Code:
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local M6D = Instance.new("Motor6D", char.Torso)
M6D.Name = "ToolGrip"
end)
end)
game.ReplicatedStorage.ConnectM6D.OnServerEvent:Connect(function(plr,location)
local char = plr.Character
char.Torso.ToolGrip.Part0 = char.Torso
char.Torso.ToolGrip.Part1 = location
end)
game.ReplicatedStorage.DisconnectM6D.OnServerEvent:Connect(function(plr)
plr.Character.Torso.ToolGrip.Part1 = nil
end)
Photo: