Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

CFrame is not a valid member of Weld?

Asked by 9 years ago

I tried tweening this weld but I got an error saying:

CFrame is not a valid member of Weld

But isn't "C0" the CFrame of Weld?

Script:

Player = game.Players.LocalPlayer
Character = Player.Character
Torso = Character.Torso
Mouse = Player:GetMouse()
Tween = require(game.Workspace.TweenBlock)
    if not Character or Character.Parent == nil then
    Character = Player.CharacterAdded:wait()
    end
-----------------------------------------
function MakeWelds()
    local Arms = {Character["Left Arm"],
                  Character["Right Arm"]
    }
    local ArmWelds = {}
    for i,v in pairs (Arms) do
        local Weld = Instance.new("Weld",Torso)
        Weld.Name = v.Name.." Weld"
        Weld.Part0 = Torso
        Weld.Part1 = v
        ArmWelds[i] = Weld
    end
    return ArmWelds
end
Welds = MakeWelds()
Tween.TweenBlock(Welds[1],Welds[1].C0*CFrame.Angles(0.5,2.5,1),1)
--Welds[1].C0 = CFrame.new(1.1,0.3,-0.5)*CFrame.Angles(0.5,2.5,1)
--Welds[2].C0 = CFrame.new(-1.1,0.3,-0.5)*CFrame.Angles(0.5,-2.5,-1)
----------------------------------------

Module:

-- Made by Player
-- http://www.roblox.com/User.aspx?ID=7118
Table = {}

Table.TweenBlock = function(Part,CF,TweenTime)
if TweenTime == 0 then
Part.CFrame = CF
else
local OldCF = Part.CFrame
local NewCF = CF
local Tick = 0
repeat
Tick = Tick + wait()
local Sin = math.sin(((Tick/TweenTime)/57.295779513082)*90) --"57.295779513082" is one Radian
local Formula = CFrame.new(OldCF.p:Lerp(NewCF.p, Sin), OldCF.p:Lerp(NewCF.p, Sin) + OldCF.lookVector:Lerp(CF.lookVector, Sin))  
Part.CFrame = Formula
until Tick > TweenTime
Part.CFrame = CF
end
end

return Table


1 answer

Log in to vote
2
Answered by
Merely 2122 Moderation Voter Community Moderator
9 years ago

The TweenBlock function expects a Part as the first argument.

TweenBlock = function(Part,CF,TweenTime)

But you're passing in a Weld object. A Weld is not a Part, it doesn't have a CFrame property.

Tween.TweenBlock(Welds[1],Welds[1].C0*CFrame.Angles(0.5,2.5,1),1)
1
Is there any scripts or module that use some sort of Tween functions that work on welds? kevinnight45 550 — 9y
Ad

Answer this question