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

Why does my block move side ways when moving it?

Asked by 5 years ago
function game.ReplicatedStorage.MV.M1.Fire:OnServerInvoke(player)
local b3 = Instance.new("Part")
b3.Shape = "Cylinder"
b3.Material = "Metal"
b3.Transparency = 0.5
b3.Size = Vector3.new(1,4,4)
b3.Anchored = true
b3.CanCollide = false
b3.BrickColor = BrickColor.new("Really red")
b3.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0,1,-2) *CFrame.Angles(0,51.8,0)
b3.Parent = game.Workspace

for i = 1,25 do
    wait(0.01)
    b3.Size = b3.Size + Vector3.new(1,0,0)
    b3.CFrame = b3.CFrame - Vector3.new(0,0,1)
end
wait(1)
b3:Destroy()
end

Basically the issue is it goes to the wrong direction as it gets longer, anyway I can fix this?

0
I'm guessing because on line 16 you're moving it one stud in the Z direction. To get it to go the other way, just do -1 instead of 1. LawlR 182 — 5y
0
Which direction do you want it to move? Have you tried changing the added vector values? SerpentineKing 3885 — 5y
0
Forward, is which way im trying to move it. XX_Scripta 11 — 5y
0
Also I put - Vector3.new(0,0,1) Wouldn't that be the same thing as -1? XX_Scripta 11 — 5y
View all comments (3 more)
0
can you show the server script please RetroGalacticGamer 331 — 5y
0
also you need to tab all your lines of code. when you make something like a function or a if statement for example, you need to indent everything in there RetroGalacticGamer 331 — 5y
0
Uh I am face planting at you rn, this is the server script, you would be able to tell this if you read it correctly. Next, indenting is not needed. XX_Scripta 11 — 5y

Answer this question