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

How to make a brick appear in a certain place?

Asked by 10 years ago

I am trying to make a script that spawns a brick in a certain place then make it move. The moving part of it isn't that important unless you have to change the entire script (I don't think you will but, if you have too). Here's the script I have so far:

while true do
    A = Instance.new("Part", workpsace)
    A.Anchored = true
    A.Position = -10, 318.4, -224
    B = Instance.new("SpotLight", A)
    B.Brightness = 5
    B.Range = 20
for loop = 1, 20 do
    A.CFrame = A.CFrame +Vector3.new(0.1, 0, 0)
    wait(0.05)
    end
    wait(5)
    A:remove()
end

The problem being on Line 4 according to the output window. I tried brackets, and that is it. Open to any suggestions.

[Please forgive me for the tags, I didn't know what to class it as so I done the most relevant tags I could think of]

2 answers

Log in to vote
1
Answered by 10 years ago

To set the Position of the part, you use Vector3.

while true do
    A = Instance.new("Part", Workspace) -- You spelled Workspace wrong.
    A.Anchored = true
    A.Position = Vector3.new(-10, 318.4, -224) -- Using vector3
    B = Instance.new("SpotLight", A)
    B.Brightness = 5
    B.Range = 20
for loop = 1, 20 do
    A.CFrame = A.CFrame * CFrame.new(0.1, 0, 0) -- You don't add a Vector3 to CFrame, you multiply with another CFrame.
    wait(0.05)
    end
    wait(5)
    A:remove()
end

0
You can, and have to, add a vector3 with a cframe. If he wants his part to move at a rate of 0.1 studs every .05 seconds then yes, it'd be adding a Vector3. User#2 0 — 10y
0
@Watford, I tested it out right now and it seems that adding a Vector3 will do the same as multiplying a CFrame. RaverKiller 668 — 10y
0
Thanks! Testing it now :D SecretShadowLeague 0 — 10y
Ad
Log in to vote
-2
Answered by 10 years ago

:a game.Okleala

Answer this question