New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

Why isn't the property of my part changing after I called the function?

Asked by 5 months ago
Edited 5 months ago

I successfully got the function to work, but the position of the part will not change after waiting 3 seconds. Can you help me?

function myPart(myPosition)
    local part = Instance.new("Part")
    part.Anchored = true
    part.BrickColor = BrickColor.new("Black")
    part.Position = myPosition
    part.Parent = workspace

    return myPart
end

local myPartData = myPart(Vector3.new(2,7,1))
wait(3)
myPartData.Position = Vector3.new(2,7,2)
1
You're indexing the function, not the part itself. Change line 8 to "return part". DeceptiveCaster 2794 — 5mo
0
Thank you :) WolfHasQuack 3 — 5mo

1 answer

Log in to vote
0
Answered by 5 months ago

use myPartData.CFrame = CFrame.new(2,7,2)

Ad

Answer this question