I'm making a Jojo game and I'm trying to figure out the summon/punching part. This comes up in the output when I try to summon my character Here's the script

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

local mainFolder = game.ReplicatedStorage.StandFolder
local Summon = mainFolder.RemoteEvents.Summon
local Punching = mainFolder.RemoteEvents.Punching
local Lean = mainFolder.RemoteEvents.Lean

Summon.OnServerEvent:Connect(function(player, isActive)
	local char = player.Character
	local hrp = char.HumanoidRootPart

	if isActive == true then
		local Stand = mainFolder.Models.Stand:Clone()
		local mainPart = Stand.PrimaryPart

		Stand.Parent = char
		mainPart.CFrame = hrp.CFrame

		local weld = Instance.new("ManualWeld")
		weld.Name = "Weld"
		weld.Part0 = mainPart
		weld.Part1 = hrp
		weld.C0 = mainPart.CFrame:ToObjectSpace(hrp.CFrame)
		weld.Parent = weld.Part0

		for i, bodyPart in pairs(Stand:GetChildren()) do
			if bodyPart:IsA("BasePart") and bodyPart ~= mainPart then
				local info = TweenInfo.new(0.45)
				local goal = {Transparency = 0}

				local tween = TweenService:Create(bodyPart, info, goal)
				tween:Play()
			end
		end

		local info = TweenInfo.new(0.5)
		local goal = {}
		goal.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)
		goal.C1 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame * CFrame.new(-3, 1.5, 3))

		local tween = TweenService:Create(weld, info, goal)
		tween:Play()

		local AnimControl = Stand.AnimationController
		local Idle = AnimControl:LoadAnimation(script.Animations.Idle)
		Idle:Play()
	else
		local Stand = char:FindFirstChild("Stand")
		local mainPart = Stand.PrimaryPart

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

				for i, bodyPart in pairs(Stand:GetChildren()) do
					if bodyPart:IsA("BasePart") and bodyPart ~= mainPart then
						local info = TweenInfo.new(0.45)
						local goal = {Transparency = 1}

						local tween = TweenService:Create(bodyPart, info, goal)
						tween:Play()
					end
				end

				local info = TweenInfo.new(0.5)
				local goal = {}
				goal.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)
				goal.C1 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)

				local tween = TweenService:Create(weld, info, goal)
				tween:Play()

				tween.Completed:Connect(function()
					Stand:Destroy()
				end)
			end
		end
	end
end)

Lean.OnServerEvent:Connect(function(player, isMoving)
	local char = player.Character
	local Stand = char:WaitForChild("Stand")

	local LeanAnim = Stand.AnimationController:LoadAnimation(script:WaitForChild("Lean"))
	LeanAnim:Play()

	if Stand then
		RunService.Heartbeat:Connect(function()
			if hum.MoveDirection ~= Vector3.new(0,0,0) then
				LeanAnim:AdjustWeight(1.001)
			else
				LeanAnim:AdjustWeight(0)
			end
		end)
	end
end)

Punching.OnServerEvent:Connect(function(player, currentAttack)
	local char = player.Character
	local Stand = char:FindFirstChild("Stand")
	local weld = Stand.HumanoidRootPart:FindFirstChild("Weld")

	local combatModule = require(script.Combat)

	Stand.HumanoidRootPart.Massless = true

	if currentAttack == 1 then
		combatModule.Main(weld, TweenService, Stand, script.Animations.RightPunch, char, currentAttack)
	elseif currentAttack == 2 then
		combatModule.Main(weld, TweenService, Stand, script.Animations.LeftPunch, char, currentAttack)
	elseif currentAttack == 3 then
		combatModule.Main(weld, TweenService, Stand, script.Animations.Smash, char, currentAttack)
	end
end)

5 comments

0

can you tell us the line where the error occurs?

0

local char = player.Character

0

line 81

0

is this a local script?

0

no, a regular script.