Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

"CFrame is not a valid member" HELP?

Player = game.Players.LocalPlayer
Character = Player.Character
Mouse = Player:GetMouse()
run = game:GetService('RunService')
function onkey(key)
	if key == "r" then
		RS = Character.Torso["Right Shoulder"]
		RS.C0 = RS.C0.CFrame*CFrame.Angles(0, 0, 1)
		Hand = Instance.new("Part", Character)
		Hand.FormFactor = "Custom"
		Hand.CanCollide = true
		Hand.Size = Vector3.new(0.2, 2.57, 0.42)
		Hand.BrickColor = BrickColor.new("Black")
		Hand.CFrame = Character.Torso.CFrame*CFrame.new(0, 2, 0)
		Weld = Instance.new("Weld",Character)
		Weld.Part0 = Weld.Parent["Right Arm"]
		Weld.Part1 = Hand
		Weld.C1 = CFrame.fromEulerAnglesXYZ(0, 0, 0) *CFrame.new(0 , 0 , 0)
		
		
	end
end
function Slash()
	for i =1, 10 do
	RS = Character.Torso["Right Shoulder"]
	RS.C0 = RS.C0 *CFrame.fromEulerAnglesXYZ(0, 0, 0.16)
	run.Stepped:wait()
	end
	for i =1, 10 do
	RS = Character.Torso["Right Shoulder"]
	RS.C0 = RS.C0 *CFrame.fromEulerAnglesXYZ(0, 0, -0.16)
	run.Stepped:wait()
	end
end

Mouse.Button1Down:connect(Slash)
Mouse.KeyDown:connect(onkey)

Basically, tried to make a sword where you would equip with r and slash or whatever you would call it with Button1Down, however I did not come far after I started getting this error.

16:36:08.019 - CFrame is not a valid member 16:36:08.020 - Script 'Players.Player.Backpack.LocalScript', Line 8 16:36:08.020 - Stack End

Any soloutions?

1 comment

0

The problem is you put "RS.C0 = Rs.C0.CFrame", change it to "RS.C0 = CFrame*CFrame.Angles(0, 0, 1)".

1 answer

Try this:

Player = game.Players.LocalPlayer
Character = Player.Character
Mouse = Player:GetMouse()
run = game:GetService('RunService')
function onkey(key)
    if key == "r" then
        RS = Character.Torso["Right Shoulder"]
        RS.C0 = RS.C0.CFrame*CFrame.Angles(0, 0, 1)
        Hand = Instance.new("Part", Character)
        Hand.FormFactor = "Custom"
        Hand.CanCollide = true
        Hand.Size = Vector3.new(0.2, 2.57, 0.42)
        Hand.BrickColor = BrickColor.new("Black")
        Hand.CFrame = Character.Torso.Position*CFrame.new(0, 2, 0)
        Weld = Instance.new("Weld",Character)
        Weld.Part0 = Weld.Parent["Right Arm"]
        Weld.Part1 = Hand
        Weld.C1 = CFrame.fromEulerAnglesXYZ(0, 0, 0) *CFrame.new(0 , 0 , 0)


    end
end
function Slash()
    for i =1, 10 do
    RS = Character.Torso["Right Shoulder"]
    RS.C0 = RS.C0 *CFrame.fromEulerAnglesXYZ(0, 0, 0.16)
    run.Stepped:wait()
    end
    for i =1, 10 do
    RS = Character.Torso["Right Shoulder"]
    RS.C0 = RS.C0 *CFrame.fromEulerAnglesXYZ(0, 0, -0.16)
    run.Stepped:wait()
    end
end

Mouse.Button1Down:connect(Slash)
Mouse.KeyDown:connect(onkey)

If this doesn't work, then I suggest trying the advice in the comment above:

The problem is you put "RS.C0 = Rs.C0.CFrame", change it to "RS.C0 = CFrame*CFrame.Angles(0, 0, 1)"

This discussion is preserved as it was. New answers, comments, and votes are closed.