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

CFrame cannot be assigned to?

Asked by 8 years ago

if this question has been answered before just direct me there, if not then I'd (obviously) ask for the answer to this problem:

script.Parent.Touched:connect(function(hit)

    if hit.Parent:FindFirstChild("Humanoid") then
        torso = hit.Parent:FindFirstChild("Torso")

            if torso ~= nil then 
                torso.Position.CFrame = CFrame.new(Vector3.new(-6, 0.5, -12))

        end
    end
end)

now I understand its probably better to use a local script, but in certain cases it may be better to use scripts inside the two parts anyway- and actually I've made another teleporter using a local script, the syntax is the same for going through the character and torso and cframe- and it works, but here it doesn't. why is this? I think the problem lies within getting to the players character, or maybe it would be slightly different outside a local script for whatever reason. (that's just my thoughts)

0
you are trying to set the CFrame to a Position and not to torso. 1waffle1 2908 — 8y
0
thanks, and hey! 1waffle1 responded to my post. I played tic tac toe with you and now this! ProgramsMan 100 — 8y

1 answer

Log in to vote
1
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
8 years ago

Your problem is with line 7. Here you wrote:

torso.Position.CFrame = CFrame.new(...)

What I assume you meant to write is:

torso.CFrame = CFrame.new(...)

Position holds a Vector3 value, which doesn't have a member called CFrame.

0
oh it was a simple mistake, my bad- but thanks anyway. ProgramsMan 100 — 8y
Ad

Answer this question