If I put a body force in the direction of the lookvector it is fine, until the block is rotated, in which the body force is still applied in the direction of the initial lookvector, and the block is facing another way, how can I get around this?

Script1:

Player = game.Players.LocalPlayer
mouse = Player:GetMouse()
open = false
wait(2)
PlayerPart = game.Workspace[Player.Name .. "'s-part"]

mouse.KeyDown:connect(function(key)
    if key:lower() == "w" then
		script.Wheld.Value = true
		
	elseif key:lower() == "a" then
		print"a"
		bodyrot = PlayerPart.BodyAngularVelocity
		bodyrot.angularvelocity = Vector3.new(0 , 2 , 0)
	elseif key:lower() == "d" then
		bodyrot.angularvelocity = Vector3.new(0 , -2, 0)
    end
end)

mouse.KeyUp:connect(function(key)
    if key:lower() == "w" then
		script.Wheld.Value = false
	elseif key:lower() == "a" or key:lower() == "d" then
		bodyrot.angularvelocity = Vector3.new(0 , 0 , 0)
	end 
end)

Script2:

Player = game.Players.LocalPlayer
mouse = Player:GetMouse()
open = false
wait(2)
PlayerPart = game.Workspace[Player.Name .. "'s-part"]
bodyfor = PlayerPart.BodyForceForwards

wheld = script.Parent.Main.Wheld
wheld.Changed:connect(function()
	if wheld == true then
		repeat bodyfor.Force = PlayerPart.CFrame.lookVector * 50 until wheld == false
	elseif wheld == false then
		bodyfor.Force = Vector3.new(0,0,0)
	end
end)

Wheld is a Boolean which is a parent of script1. Thank you.

2 comments

0

Looks like you already did it with repeat bodyfor.Force = ...

0

@cabbler That doesnt change it at all sadly, not sure why either.