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

CFraming erroring every time?

Asked by 7 years ago

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

Log in to vote
0
Answered by 7 years ago

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! :)

0
To note, there's also 'CFrame.p', however, I never checked if it's read-only or can be redefined/ changed. TheeDeathCaster 2368 — 7y
0
It would be read only. OldPalHappy 1477 — 7y
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. OldPalHappy 1477 — 7y
0
ik thats why it waits for child humanoid and I just remebered that CFrame aint part of Position GimmeWaffleBruh 18 — 7y
Ad

Answer this question