Creating throwable shield

New doom game came out and im trying to recreate some of the features.

I want to know how I could make this shield be thrown in the air, and then come back to the player. Kinda like a captain america shield. Kinda like a projectile??? any ideas??

3 Likes

You could make the shield in the players hand become invisible and then clone a shield at its position and then of course rotate it in the way you want it to be thrown and then you just apply body movers or constraints or whatever and then once it reaches a length you want the cutoff to be just make it return back to you in like a heartbeat loop or something

3 Likes

so that is pretty close to what i did but i instead just parented the shield to workspace and removed the motor6ds, instead of using physics i tweened the shield for throwing.

My only problem is I want the shield to be rotated on its when thrown but for some reason the CFrame just doesnt wanna work.

–The Script

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local char = plr.Character or plr.CharacterAdded:Wait()

local HumRoot = char:WaitForChild("HumanoidRootPart")

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

mouse.Button1Down:Connect(function ()
	local viewmodel = game.Workspace.ViewmodelFolder:FindFirstChild("Viewmodel")
	local LeftArm = viewmodel:FindFirstChild("Left Arm")

	if viewmodel then
		local shield = viewmodel:FindFirstChild("Shield")
		if shield then
			shield.Parent = game.Workspace
			LeftArm.LeftWeapon:Destroy()
			shield.PrimaryPart.CanCollide = true
			shield.PrimaryPart.Anchored = true
			shield.PrimaryPart.CFrame = HumRoot.CFrame * CFrame.Angles(math.rad(45),0,0)
			
			local Tween = TweenSerivice:Create(shield.PrimaryPart, TweenInfo.new(0.5, Enum.EasingStyle.Sine), {CFrame = HumRoot.CFrame * CFrame.new(0,0,-50) * CFrame.Angles(math.rad(45),0,0)})
			Tween:Play()
			Tween.Completed:Connect(function ()
				--local Tween2 = TweenSerivice:Create(shield.PrimaryPart, TweenInfo.new(0.5, Enum.EasingStyle.Sine), {CFrame = HumRoot.CFrame})
				--Tween2:Play()
				local connection
				local alphaADD = 0

				connection = RunService.RenderStepped:Connect(function ()

					shield.PrimaryPart.CFrame = shield.PrimaryPart.CFrame:Lerp(HumRoot.CFrame * CFrame.Angles(math.rad(45),0,0), 0.1 + alphaADD)
					alphaADD += 0.01

					local magnitude = (HumRoot.Position - shield.PrimaryPart.Position).Magnitude

					if connection and magnitude < 0.5 then 
						print("YES")
						connection:Disconnect()
					end
				end)

			end)

		end
	end
end)

(used Lerp() for the shield callback, works like a charm)

what the shield looks like when thrown:

what it should look like:

1 Like

also im kinda worried i should be moving this to scripting support??

2 Likes

yeah move it to scripting support, thats probably one of the main reasons you didnt get much replies

2 Likes

Oh yeah dont use CFrame use something like a BodyGyro it would work in conjunction with the BodyMover your using for movement better

2 Likes

I still can’t figure out why i cant rotate it so its thrown sideways?

1 Like