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

Why won't this script work?

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.

2 comments

0

P.S - I haven't added anything for the second brick/mesh yet.

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.

1 answer

✓ Accepted answer

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)

2 comments

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.

0

Nope it's a lightsaber script. Don't correct me smartass.

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