Currently, I am making a custom JoJo's Bizarre Adventure stand engine. At the moment, I have gotten the summon script done with no error. Well.. output errors. When the script starts, it makes 2 clones of the dummy variable (local Stand and StandModel which might be the cause). Anyone know why?

game:GetService("ReplicatedStorage").DefStand.Summon.OnServerEvent:Connect(function(player)
    local sound = workspace.DS_summon
    local Stand = game:GetService("ServerStorage").DefaultStand:Clone()
    local StandModel = Stand.Dummy:Clone()
    local debounce = false

    sound:Play()
    StandModel.Parent = workspace
    if StandModel then
        local function summonWeld()
			
            local char = player.Character or player.CharacterAdded:Wait() --Error here.
            local weld = Instance.new("Weld")
			local humanoid = StandModel:WaitForChild("Humanoid")
			local anim = Instance.new("Animation")
			anim.AnimationId = "rbxassetid://5021923557"
			local animTrack = humanoid:LoadAnimation(anim)
			animTrack:Play()
			
			weld.Parent = game.Workspace
            weld.Part0 = char.HumanoidRootPart
            weld.Part1 = StandModel.HumanoidRootPart
        end
        summonWeld()		
    end
end)

game:GetService("ReplicatedStorage").DefStand.Callbackstand.OnServerEvent:Connect(function()
	local Stand = game.Workspace.Dummy
	if Stand then
		local Stand = game.Workspace.Dummy:Destroy()
		local weld = game.Workspace.Weld:Destroy()
	end
end)

3 comments

0

Could it be the localscript causing the stand to clone twice?

0

maybe because the onserverevent is occuring twice

0

Solved it, I had a duplicate script in my game. Thanks for the help though!