I have like a morph transformation tool in serverstorage that gets cloned and is given to the player, it works fine the first time but when i reset and get a new clone of the tool it doesnt work. the activated event doesnt even fire.
local character = game.ReplicatedStorage.RobotModel
local animMorphTemplate = game.ReplicatedStorage.animRobot
local TweenService = game:GetService("TweenService")
local function morph()
local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent.Parent)
plr.Character.Humanoid.WalkSpeed = 0
plr.Character.Humanoid.JumpPower = 0
plr.Character.Humanoid.JumpHeight = 0
plr.Character.Humanoid.AutoRotate = false
local charClone = character:Clone()
charClone.Name = plr.Name
local rootPart = charClone.HumanoidRootPart
local plrRoot = plr.Character.HumanoidRootPart
script.Parent.Parent.Activated:Connect(morph)
local animMorph = animMorphTemplate:Clone()
animMorph.Parent = workspace
animMorph:SetPrimaryPartCFrame(plrRoot.CFrame * CFrame.new(0, 50, 10))
local fallTween = TweenService:Create(
animMorph.PrimaryPart,
TweenInfo.new(4, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out),
{CFrame = plrRoot.CFrame * CFrame.new(0, 5, 10)}
)
fallTween:Play()
task.wait(5)
local weld = Instance.new("WeldConstraint")
weld.Parent=animMorph.LeftHand
weld.Part0 = animMorph.LeftHand
weld.Part1 = plrRoot
local animation = animMorph.Cutscene
local playAnim = animMorph.Humanoid.Animator:LoadAnimation(animation)
playAnim:Play()
task.wait(.8)
weld:Destroy()
plr.Character = charClone
animMorph:Destroy()
if rootPart and plrRoot then
rootPart.CFrame = plrRoot.CFrame + Vector3.new(0,5,0)
end
charClone.Parent = workspace
charClone.RobotScript.Enabled = true
wait(.5)
end
script.Parent.Parent.Activated:Connect(morph)
everything is archivable and this is a server script inside the tool.