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

Why won't this script work?

Asked by
Avectus 120
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I've made this script for a lightsaber when a player press 'q' the lightsaber blade ignites. http://prntscr.com/6oekhl

But for some reason this is what happens: https://www.youtube.com/watch?v=wNfuFzj52Is

Can anyone tell me why this happens or tell me what I need to do/change?

Thanks.

0
P.S - I haven't added anything for the second brick/mesh yet. Avectus 120 — 9y
0
You should just paste your code here instead of giving a screenshot of it... There's Lua code formatting so that it looks nice here, too. BlueTaslem 18071 — 9y

1 answer

Log in to vote
-1
Answered by 9 years ago

So basically, you're not defining the positions before the script is started. Also, you're not telling the script where the position of the part is.

There's a huge conflict within this, I believe you can fix it this way;

-- Defining the position

SaberM2PositionY = SaberM2.Position.Y
SaberM2PositionX = SaberM2.Position.X
SaberM2PositionZ = SaberM2.Position.Z

SaberM2PositionY = SaberM2.Position.Y
SaberM2PositionX = SaberM2.Position.X
SaberM2PositionZ = SaberM2.Position.Z

-- Correctly making the position
for i = 1, 9 do
Saber.SABERSNAME.Position.X = SaberM2PositionX
Saber.SABERSNAME.Position.Y = SaberM2PositionY
Saber.SABERSNAME.Position.Z = SaberM2PositionZ

Saber.SECONDSABERNAME.Position.X = SaberMPositionX
Saber.SECONDSABERNAME.Position.Y = SaberMPositionY
Saber.SECONDSABERNAME.Position.Z = SaberMPositionZ

wait()

-- saberscalecode

end
end
end)

0
No where is the position of anything set in the original. He's setting offset, which is *relative to the part*. The implementation you've provided is *much more wrong*. Neither is setting the X, Y, and Z of a vector3 valid. BlueTaslem 18071 — 9y
0
Nope it's a lightsaber script. Don't correct me smartass. TheReapersComing 0 — 9y
Ad

Answer this question