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

VectorForce.Force doesn't change through a script?

So what I'm trying to achieve is a player-controlled block through the input of WASD or the Up Down Left Right keys.

The script works correctly, the value sent during the remote event gets sent correctly, I tested it with the debugger and the value (Vector3Value) reaches the

workspace.ControlledBlock.Block.VectorForce.Force = Vector3Value

Yes, the Vector3Value is (Vector3.new(0,0,-7000)) which is what I want. However, the

workspace.ControlledBlock.Block.VectorForce.Force

remains Vector3.new(0,0,0). Thus, "Block" does not move.

The script shows no error, it flows smooth as silk.

Just the property VectorForce.Force doesn't change.

Why is that? Is it because it can't be changed through a script?

If so, what other choices do I have If I want to avoid CFrame? (because I don't know how to script the collision with other parts using CFrame plus using CFrame confuses me)

5 comments

0

You might have to make the other block the force, too.

0

If it's a localscript then it might not change if the block wasn't created through a localscript, but that's all I know so far.

0

Is the "Block" archored? That is the only question I can ask right now.

0
  1. There's no "other block", the VectorForce is in the block called "Block"
0
  1. The input was in local script, the Vector3Value data gets sent with a remote event to a server script in the "Block" 3) The "Block" isn't anchored. I've tested changing it manually through the property menu and it moves.

2 answers

✓ Accepted answer

Alright, the problem I was having was I mixed in Instances and Property in the same variable. Apparently, you can't make a variable go through both.

Example:

local Force = workspace.Block.VectorForce.Force Force = Vector3.new(0,0,10000)

-- That won't work because for whatever reasons I mixed Block.VectorForce with VectorForce.Force which is a property.

So, here's my solution

local Force = workspace.Block.VectorForce Force.Force = Vector3.new(0,0,10000)

I put this up incase anyone with the same habit of writing variables like this can learn.

Thanks to those who tried helping me!

CFrames (Coordinate Frame) is a function that is basically rotates / move a part to its X,Y,Z position CFrame.new creates vector3 value (X,Y,Z)

If you want to learn more please visit: https://developer.roblox.com/en-us/api-reference/datatype/CFrame

And the reason your block did not move is because you forgot to add position

part = script.Parent
part.Position = Vector3.new(0,5,9) -- the position you want it to move

If that didn't work your part should not be anchored

To learn more about Vector3 AlvinBlox made a video all about Vector3 https://m.youtube.com/watch?v=DOJZnCCU3zA

1 comment

0

I'm working with VectorForce, which is much like BodyForce but it uses Vector3 to apply force. It's not changing the position like instataneously. Plus, I want to avoid CFrame.

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