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

CFraming erroring every time?

Well every time I use this code for my game is says CFrame cannot be assigned to

heres the code:

function f(hit)
	hit.Parent:WaitForChild("Humanoid")
	hit.Position.CFrame=CFrame.new(-2763.989, -34.075, 95.13)
end

script.Parent.Touched:Connect(f)

Help me!

1 answer

✓ Accepted answer

The CFrame is not part of the Position. Simply set hit.CFrame instead of hit.Position.CFrame. Try this code, I have altered it to fix the problem:

function f(hit)
    hit.Parent:WaitForChild("Humanoid")
    hit.CFrame = CFrame.new(-2763.989, -34.075, 95.13)
end

script.Parent.Touched:Connect(f)

Leave an upvote and accept the answer if I helped! :)

4 comments

0

To note, there's also 'CFrame.p', however, I never checked if it's read-only or can be redefined/ changed.

0

It would be read only.

0

NOTE: You probably don't want to CFrame hit, but rather the torso or model of characters. To do this you would also wanna check for the character.

0

ik thats why it waits for child humanoid and I just remebered that CFrame aint part of Position

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