This is a checker

while true do wait()
	if script.Parent.W.Value == true then	
		script.Parent.Force = Vector3.new(2000,0,0)
	elseif script.Parent.W.Value == false then
		script.Parent.Force = Vector3.new(0,0,0)
	end
end

This is the User inputs, Basically you control a Part so when pressing 'W' it makes the 'BoolValue' true which in turn fires the script above to set the 'Vector 3', and on release turns that value to false.

-- FORWARD
local Fetch = game:GetService("UserInputService")
Fetch.InputBegan:connect(function(inst)
    if inst.KeyCode == Enum.KeyCode.W then
        print("W key pressed")
		game.Workspace.Player.BodyForceW.W.Value = true
    end
end)

Fetch.InputEnded:connect(function(inst)
    if inst.KeyCode == Enum.KeyCode.W then
        print("W key released")
		game.Workspace.Player.BodyForceW.W.Value = false
    end
end)
-- BACKWARD
Fetch.InputBegan:connect(function(inst)
    if inst.KeyCode == Enum.KeyCode.S then
        print("S key pressed")
		game.Workspace.Player.BodyForceS.S.Value = true
    end
end)

Fetch.InputEnded:connect(function(inst)
    if inst.KeyCode == Enum.KeyCode.S then
        print("S key released")
		game.Workspace.Player.BodyForceS.S.Value = false
    end
end)
-- LEFT
Fetch.InputBegan:connect(function(inst)
    if inst.KeyCode == Enum.KeyCode.A then
        print("A key pressed")
		game.Workspace.Player.BodyForceA.A.Value = true
    end
end)

Fetch.InputEnded:connect(function(inst)
    if inst.KeyCode == Enum.KeyCode.A then
        print("A key released")
		game.Workspace.Player.BodyForceA.A.Value = false
    end
end)
-- RIGHT
Fetch.InputBegan:connect(function(inst)
    if inst.KeyCode == Enum.KeyCode.D then
        print("D key pressed")
		game.Workspace.Player.BodyForceD.D.Value = true
    end
end)

Fetch.InputEnded:connect(function(inst)
    if inst.KeyCode == Enum.KeyCode.D then
        print("D key released")
		game.Workspace.Player.BodyForceD.D.Value = false
    end
end)

In game all of the 'prints' fire making me assume there is no fault here.

(Yes this is probably inefficient)

i then added a simple script which changes the bool value which works, Only difference here is the script below was a 'Script' where as the other was a 'Local Script'.

wait(5)
script.Parent.BodyForceW.W.Value = true

2 comments

0

You need to give us more. For instance the script that sets the BoolValue

0

Ok should be enough info now?