I'm trying to make a shield, and when you press t a part is supposed to spawn 1 stud in front of you, but instead it doesn't spawn at all and returns this error:
bad argument #3 to CFrame (CFrame expected, got Vector3)
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local chr = plr.Character or plr.CharacterAdded:wait()
local shield = Instance.new("Part")
shield.Anchored = true
shield.Transparency = .8
shield.CanCollide = false
shield.FormFactor = "Custom"
shield.Size = Vector3.new(.2,.2,.2)
shield.BottomSurface = "Smooth"
shield.TopSurface = "Smooth"
mouse.KeyDown:connect(function(key)
if key == 't' then
chr.Humanoid.WalkSpeed = 0
clone = shield:Clone()
clone.Parent = workspace
clone.CFrame = chr.Torso.CFrame.lookVector*10
clone.Touched:connect(function(p)
if p and p.Locked == false then
p:Destroy()
end
end)
for i = 1,25 do
game:GetService('RunService').RenderStepped:wait()
clone.Size = clone.Size + Vector3.new(.2,.2,0)
end
end
end)
mouse.KeyUp:connect(function(key)
if key == 't' then
chr.Humanoid.WalkSpeed = 16
for i = 1,25 do
game:GetService('RunService').RenderStepped:wait()
clone.Size = clone.Size - Vector3.new(.2,.2,0)
end
clone:Destroy()
end
end)
https://gyazo.com/e262c4ddec79b0ac8b6d1ababf1a1302 is what i want to happen

2 comments
What is the error line in the code, exactly? :P
@TheAlphaStigma 19