So, I'm making a Jojo game, and starting off with a classical stand, however, this code doesn't seem to be working and is showing an error, but I can't seem to find it.

The Code:

local rp = game:GetService("ReplicatedStorage") local summon = rp:WaitForChild("Summon")

local TweenService = game:GetService("TweenService") local Debris = game:GetService("Debris")

summon.OnServerEvent:Connect(function(Player,isActive) local Character = Player.Character local Humanoid = Character.Humanoid local Hurmp = Character.HumanoidRootPart

if isActive then
	local Stand = script:WaitForChild("Stand"):Clone()

	for _, part in pairs(Stand:GetChildren())do
		if part:IsA("BasePart") then
			part.Transparency = 1
		end
	end

	Stand.Parent = Character
	Stand.PrimaryPart.CFrame = Hurmp.CFrame

	local weld = Instance.new("ManualWeld")
	weld.Name = "Controller"
	weld.Part0 = Stand.PrimaryPart
	weld.Part1 = Hurmp
	weld.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)
	weld.Parent = weld.Part0

	local AnimControl = Stand:FindFirstChild("AnimControl")
	local standHumrp = Stand:FindFirstChild("HumanoidRootPart")

	local Idle = AnimControl:LoadAnimation(script.Idle)
	Idle:Play()

	for _, part in pairs(Stand:GetChildren())do
		if part:IsA("BasePart") and part ~= standHumrp then
			local goal = {}
			goal. Transparency = 0
			local info = TweenInfo.new(.5)
			local tween = TweenService:Create(part,info,goal)
			tween:Play()
		end
	end

	local goal = {}
	goal.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)
	goal.C1 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame) * CFrame.new(3,1,2)--change to your stand position
	local info = TweenInfo.new(.5)
	local tween = TweenService:Create(weld,info,goal)
	tween:Play()
else
	local Stand = Character:FindFirstChild("Stand")
	if Stand then

		local Controller = Stand.PrimaryPart:FindFirstChild("Controller")
		if Controller then

			local standHumrp = Stand:FindFirstChild("HumanoidRootPart")

			for _, part in pairs(Stand:GetChildren())do
				if part:IsA("BasePart") and part ~= standHumrp then
					local goal = {}
					goal. Transparency = 1
					local info = TweenInfo.new(.5)
					local tween = TweenService:Create(part,info,goal)
					tween:Play()
				end
			end

			local goal = {}
			goal.C0 = Controller.Part0.CFrame:ToObjectSpace(Controller.Part1.CFrame)
			goal.C1 = Controller.Part0.CFrame:ToObjectSpace(Controller.Part1.CFrame) * CFrame.new(0,0,0)
			local info = TweenInfo.new(.5)
			local tween = TweenService:Create(Controller,info,goal)
			tween:Play()

			tween.Completed:Connect(function()
				Debris:AddItem(Stand,.05)
			end)

		end
	end

end

1 comment

0

This error you say, I believe is the work of a stand user O_O!!!!!!!!!!11